Add object primitives, official ext/llm, and HTTPS/dotenv platform.

Introduce # objects with ## methods (handles + ` x.method `), ship OpenAI-compatible ext/llm, and upgrade net/sys for HTTPS headers and dotenv loading.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-06 11:53:14 +08:00
1 parent b974f10c6e
commit b00b018056
55 files changed
+1741 -291

No files matched your search

+4 -4
View File
@@ -3,23 +3,23 @@ title: lib/foreign
description: Run bound code fences and inline sources via local interpreters
---
# set_cmd
## set_cmd
- lang
- cmd
**> host_foreign_set_cmd lang=`lang` cmd=`cmd`**
# run
## run
- code
**> host_foreign_run code=`code`**
# run_lang
## run_lang
- lang
- source
**> host_foreign_run_lang lang=`lang` source=`source`**
# langs
## langs
**> host_foreign_langs**
+7 -7
View File
@@ -3,39 +3,39 @@ title: lib/fs
description: English filesystem wrappers
---
# read_text
## read_text
- path
**> host_read_text path=`path`**
# write_text
## write_text
- path
- text
**> host_write_text path=`path` text=`text`**
# append_text
## append_text
- path
- text
**> host_append_text path=`path` text=`text`**
# exists
## exists
- path
**> host_exists path=`path`**
# list_dir
## list_dir
- path
**> host_list_dir path=`path`**
# make_dir
## make_dir
- path
**> host_make_dir path=`path`**
# remove
## remove
- path
**> host_remove path=`path`**
+9 -4
View File
@@ -3,23 +3,28 @@ title: lib/json
description: JSON parse/stringify (shared EN/ZH import)
---
# parse
## parse
- text
**> host_json_parse text=`text`**
# stringify
## stringify
- value
**> host_json_stringify value=`value`**
# get
## get
- value
- key
**> host_json_get value=`value` key=`key`**
# keys
## keys
- value
**> host_json_keys value=`value`**
## quote
- text
**> host_json_quote text=`text`**
+36 -36
View File
@@ -3,183 +3,183 @@ title: lib/math
description: High-school math — num, random, formula, plot
---
# pi
## pi
**> host_pi**
# e
## e
**> host_e**
# num
## num
- value
**> host_num value=`value`**
# add
## add
- a
- b
**> host_math_add a=`a` b=`b`**
# sub
## sub
- a
- b
**> host_math_sub a=`a` b=`b`**
# mul
## mul
- a
- b
**> host_math_mul a=`a` b=`b`**
# div
## div
- a
- b
**> host_math_div a=`a` b=`b`**
# pow
## pow
- a
- b
**> host_math_pow a=`a` b=`b`**
# neg
## neg
- value
**> host_math_neg value=`value`**
# sin
## sin
- value
**> host_math_sin value=`value`**
# cos
## cos
- value
**> host_math_cos value=`value`**
# tan
## tan
- value
**> host_math_tan value=`value`**
# asin
## asin
- value
**> host_math_asin value=`value`**
# acos
## acos
- value
**> host_math_acos value=`value`**
# atan
## atan
- value
**> host_math_atan value=`value`**
# sqrt
## sqrt
- value
**> host_math_sqrt value=`value`**
# abs
## abs
- value
**> host_math_abs value=`value`**
# ln
## ln
- value
**> host_math_ln value=`value`**
# exp
## exp
- value
**> host_math_exp value=`value`**
# floor
## floor
- value
**> host_math_floor value=`value`**
# ceil
## ceil
- value
**> host_math_ceil value=`value`**
# min
## min
- a
- b
**> host_math_min a=`a` b=`b`**
# max
## max
- a
- b
**> host_math_max a=`a` b=`b`**
# random
## random
**> host_random**
# random_int
## random_int
- min
- max
**> host_random_int min=`min` max=`max`**
# seed
## seed
- value
**> host_seed value=`value`**
# formula
## formula
- text
**> host_formula value=`text`**
# simplify
## simplify
- formula
**> host_simplify value=`formula`**
# expand
## expand
- formula
**> host_expand value=`formula`**
# diff
## diff
- formula
- var
**> host_diff formula=`formula` var=`var`**
# subs
## subs
- formula
- var
- value
**> host_subs formula=`formula` var=`var` value=`value`**
# eval
## eval
- formula
- var
- value
**> host_eval formula=`formula` var=`var` value=`value`**
# solve
## solve
- formula
- var
**> host_solve formula=`formula` var=`var`**
# plot
## plot
- formula
- var
- min
@@ -187,13 +187,13 @@ description: High-school math — num, random, formula, plot
**> host_plot formula=`formula` var=`var` min=`min` max=`max`**
# plot_points
## plot_points
- xs
- ys
**> host_plot_points xs=`xs` ys=`ys`**
# plot_conic
## plot_conic
- kind
- a
+16 -4
View File
@@ -1,20 +1,32 @@
---
title: lib/net
description: English minimal HTTP wrappers
description: English HTTP(S) wrappers. Optional headers / content_type via host aliases.
---
# http_get
## http_get
- url
HTTPS supported. Optional named arg `headers=` (map).
**> host_http_get url=`url`**
# http_post
## http_post
- url
- body
Default content type is JSON. Optional `content_type=` / `headers=` (map).
**> host_http_post url=`url` body=`body`**
# url_encode
## http_request
- method
- url
Optional `body=` / `content_type=` / `headers=`.
**> host_http_request method=`method` url=`url`**
## url_encode
- text
**> host_url_encode text=`text`**
+13 -7
View File
@@ -1,33 +1,39 @@
---
title: lib/sys
description: English system wrappers
description: English system wrappers (load_dotenv accepts optional path via host alias)
---
# env_get
## env_get
- name
**> host_env_get name=`name`**
# env_set
## env_set
- name
- value
**> host_env_set name=`name` value=`value`**
# args
## load_dotenv
Load `.env` (optional named arg `path=`). Existing process env is not overridden.
**> host_dotenv_load**
## args
**> host_args**
# cwd
## cwd
**> host_cwd**
# exit
## exit
- code
**> host_exit code=`code`**
# exec
## exec
- cmd
**> host_exec cmd=`cmd`**
+2 -2
View File
@@ -3,12 +3,12 @@ title: lib/table
description: English table helpers over len / at
---
# rows
## rows
- xs
**> len `xs`**
# row_at
## row_at
- xs
- i
+3 -3
View File
@@ -3,18 +3,18 @@ title: lib/text
description: English text helpers over trim / split / join
---
# str_trim
## str_trim
- s
**> trim `s`**
# str_split
## str_split
- s
- sep
**> split value=`s` sep=`sep`**
# str_join
## str_join
- xs
- sep
+5 -5
View File
@@ -3,26 +3,26 @@ title: lib/time
description: English time wrappers
---
# now_unix
## now_unix
**> host_now_unix**
# now_ms
## now_ms
**> host_now_ms**
# format
## format
- unix
- pattern
**> host_format_time unix=`unix` pattern=`pattern`**
# sleep_ms
## sleep_ms
- ms
**> host_sleep_ms ms=`ms`**
# parse
## parse
- text
- pattern
+4 -4
View File
@@ -3,23 +3,23 @@ title: lib/外联
description: 通过本机解释器运行绑定的代码围栏与内联源码
---
# 设置命令
## 设置命令
- 语言
- 命令
**> host_foreign_set_cmd lang=`语言` cmd=`命令`**
# 运行
## 运行
- 代码
**> host_foreign_run code=`代码`**
# 按语言运行
## 按语言运行
- 语言
- 源码
**> host_foreign_run_lang lang=`语言` source=`源码`**
# 语言表
## 语言表
**> host_foreign_langs**
+36 -36
View File
@@ -3,183 +3,183 @@ title: lib/数学
description: 高中数学 — 数值、随机、公式、作图
---
# 圆周率
## 圆周率
**> host_pi**
# 自然底数
## 自然底数
**> host_e**
# 数
## 数
- value
**> host_num value=`value`**
# 加
## 加
- a
- b
**> host_math_add a=`a` b=`b`**
# 减
## 减
- a
- b
**> host_math_sub a=`a` b=`b`**
# 乘
## 乘
- a
- b
**> host_math_mul a=`a` b=`b`**
# 除
## 除
- a
- b
**> host_math_div a=`a` b=`b`**
# 幂
## 幂
- a
- b
**> host_math_pow a=`a` b=`b`**
# 负
## 负
- value
**> host_math_neg value=`value`**
# 正弦
## 正弦
- value
**> host_math_sin value=`value`**
# 余弦
## 余弦
- value
**> host_math_cos value=`value`**
# 正切
## 正切
- value
**> host_math_tan value=`value`**
# 反正弦
## 反正弦
- value
**> host_math_asin value=`value`**
# 反余弦
## 反余弦
- value
**> host_math_acos value=`value`**
# 反正切
## 反正切
- value
**> host_math_atan value=`value`**
# 平方根
## 平方根
- value
**> host_math_sqrt value=`value`**
# 绝对值
## 绝对值
- value
**> host_math_abs value=`value`**
# 对数
## 对数
- value
**> host_math_ln value=`value`**
# 指数
## 指数
- value
**> host_math_exp value=`value`**
# 向下取整
## 向下取整
- value
**> host_math_floor value=`value`**
# 向上取整
## 向上取整
- value
**> host_math_ceil value=`value`**
# 最小
## 最小
- a
- b
**> host_math_min a=`a` b=`b`**
# 最大
## 最大
- a
- b
**> host_math_max a=`a` b=`b`**
# 随机
## 随机
**> host_random**
# 随机整数
## 随机整数
- min
- max
**> host_random_int min=`min` max=`max`**
# 设种子
## 设种子
- value
**> host_seed value=`value`**
# 公式
## 公式
- text
**> host_formula value=`text`**
# 化简
## 化简
- formula
**> host_simplify value=`formula`**
# 展开
## 展开
- formula
**> host_expand value=`formula`**
# 求导
## 求导
- formula
- var
**> host_diff formula=`formula` var=`var`**
# 代入
## 代入
- formula
- var
- value
**> host_subs formula=`formula` var=`var` value=`value`**
# 求值
## 求值
- formula
- var
- value
**> host_eval formula=`formula` var=`var` value=`value`**
# 求解
## 求解
- formula
- var
**> host_solve formula=`formula` var=`var`**
# 绘图
## 绘图
- formula
- var
- min
@@ -187,13 +187,13 @@ description: 高中数学 — 数值、随机、公式、作图
**> host_plot formula=`formula` var=`var` min=`min` max=`max`**
# 绘点列
## 绘点列
- xs
- ys
**> host_plot_points xs=`xs` ys=`ys`**
# 绘圆锥
## 绘圆锥
- kind
- a
+7 -7
View File
@@ -3,39 +3,39 @@ title: lib/文件
description: 中文文件系统包装
---
# 读文本
## 读文本
- 路径
**> host_read_text path=`路径`**
# 写文本
## 写文本
- 路径
- 内容
**> host_write_text path=`路径` text=`内容`**
# 追加文本
## 追加文本
- 路径
- 内容
**> host_append_text path=`路径` text=`内容`**
# 存在
## 存在
- 路径
**> host_exists path=`路径`**
# 列目录
## 列目录
- 路径
**> host_list_dir path=`路径`**
# 建目录
## 建目录
- 路径
**> host_make_dir path=`路径`**
# 删除
## 删除
- 路径
**> host_remove path=`路径`**
+3 -3
View File
@@ -3,18 +3,18 @@ title: lib/文本
description: 中文文本库:去空白 / 拆分 / 拼接
---
# 去空白
## 去空白
- s
**> trim `s`**
# 拆分
## 拆分
- s
- sep
**> split value=`s` sep=`sep`**
# 拼接
## 拼接
- xs
- sep
+5 -5
View File
@@ -3,26 +3,26 @@ title: lib/时间
description: 中文时间包装
---
# 此刻秒
## 此刻秒
**> host_now_unix**
# 此刻毫秒
## 此刻毫秒
**> host_now_ms**
# 格式化
## 格式化
- 秒
- 格式
**> host_format_time unix=`秒` pattern=`格式`**
# 睡眠毫秒
## 睡眠毫秒
- 毫秒
**> host_sleep_ms ms=`毫秒`**
# 解析时间
## 解析时间
- 内容
- 格式
+13 -7
View File
@@ -1,33 +1,39 @@
---
title: lib/系统
description: 中文系统包装
description: 中文系统包装(加载环境 可选 路径=)
---
# 取环境
## 取环境
- 名
**> host_env_get name=`名`**
# 设环境
## 设环境
- 名
- 值
**> host_env_set name=`名` value=`值`**
# 参数表
## 加载环境
加载 `.env`(可选具名实参 `路径=`)。不覆盖已有进程环境变量。
**> host_dotenv_load**
## 参数表
**> host_args**
# 工作目录
## 工作目录
**> host_cwd**
# 退出
## 退出
- 码
**> host_exit code=`码`**
# 执行
## 执行
- 命令
**> host_exec cmd=`命令`**
+16 -4
View File
@@ -1,20 +1,32 @@
---
title: lib/网络
description: 中文简易网络包装
description: 中文 HTTP(S) 包装。可选 headers / content_type 经宿主别名绑定。
---
# 获取
## 获取
- 地址
支持 HTTPS。可选具名实参 `headers=`(映射)。
**> host_http_get url=`地址`**
# 提交
## 提交
- 地址
- 内容
默认 Content-Type 为 JSON。可选 `content_type=` / `headers=`。
**> host_http_post url=`地址` body=`内容`**
# 编码地址
## 请求
- 方法
- 地址
可选 `body=` / `content_type=` / `headers=`。
**> host_http_request method=`方法` url=`地址`**
## 编码地址
- 内容
**> host_url_encode text=`内容`**
+2 -2
View File
@@ -3,12 +3,12 @@ title: lib/表
description: 中文表库:行数 / 取行
---
# 行数
## 行数
- xs
**> len `xs`**
# 取行
## 取行
- xs
- i