Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e61dca9d8 | ||
|
|
ba675a4767 |
No files matched your search
@@ -126,6 +126,8 @@ jobs:
|
||||
## Marqdo ${{ github.ref_name }}
|
||||
|
||||
### 亮点 / Highlights
|
||||
- **v1.4.6**:裸自增升参——首次粗体赋值左值即声明;`n = n + 1` 无反引号也是必选形参
|
||||
- **v1.4.6**: Bare self-increment is a required parameter — first bold assignment LHS is a declaration
|
||||
- **v1.4.5**:Streamable HTTP MCP + web invoke Bearer/401 · openai/agent json.get 硬化
|
||||
- **v1.4.5**: Streamable HTTP MCP + web invoke Bearer/401; openai/agent json.get hardening
|
||||
- **v1.4.2**:Agent/LLM 优化 O1–O5——sandbox trial · promote proof · step_route/EFI/cost · lint · quarantine
|
||||
|
||||
@@ -8,6 +8,26 @@
|
||||
|
||||
### Changed
|
||||
|
||||
## v1.4.6 — 2026-10-16
|
||||
|
||||
### Highlights
|
||||
|
||||
**裸自增升参**:粗体首次赋值的左值按设计 §8.2 视为声明。`**n = n + 1**` 在没有反引号提及时也会把 `n` 升成必选形参;缺参报 `missing argument for parameter`,不再是函数体内的 `undefined variable`。纯局部赋值(`**score = 1**`)与循环变量不升参。CLI · wasm **1.4.6**(扩展包仍为 **1.4.5**)。
|
||||
|
||||
```bash
|
||||
git checkout v1.4.6 && cargo build --release
|
||||
```
|
||||
|
||||
**核心表面 Δ(Core surface Δ)**:**无增删**——升参与 §8.2 对齐(赋值左值声明);不改 MQ 关键词 / 表几何。
|
||||
|
||||
### Fixed
|
||||
|
||||
- **升参**:`merge_inferred_params` 纳入首次粗体赋值左值。右值在绑定前读取同名(`n = n + 1`)时,该名成为必选推断形参。
|
||||
|
||||
### Changed
|
||||
|
||||
- CLI / wasm SemVer **1.4.6**。扩展包保持 **1.4.5**。
|
||||
|
||||
## v1.4.5 — 2026-10-16
|
||||
|
||||
### Highlights
|
||||
|
||||
Generated
+2
-2
@@ -572,7 +572,7 @@ checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
|
||||
|
||||
[[package]]
|
||||
name = "marqdo"
|
||||
version = "1.4.5"
|
||||
version = "1.4.6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
@@ -603,7 +603,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "marqdo-wasm"
|
||||
version = "1.4.5"
|
||||
version = "1.4.6"
|
||||
dependencies = [
|
||||
"marqdo",
|
||||
"serde_json",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "marqdo"
|
||||
version = "1.4.5"
|
||||
version = "1.4.6"
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
description = "Marqdo — Markdown markers as an interpreted programming language"
|
||||
|
||||
@@ -149,8 +149,9 @@ marqdo catalog public -o .marqdo
|
||||
|
||||
---
|
||||
|
||||
## 现状(v1.4.5)
|
||||
## 现状(v1.4.6)
|
||||
|
||||
- **裸自增升参(v1.4.6)**:首次粗体赋值左值即声明;`**n = n + 1**` 无反引号也升为必选形参。扩展包仍为 **1.4.5**
|
||||
- **Streamable HTTP MCP + web invoke 鉴权(v1.4.5)**:`agent_mcp_serve transport=http` · Bearer/`X-Api-Key` 注入 · `unauthorized`→401 · openai/agent `json.get` 硬化
|
||||
- **LLM 传输软失败 + `ext/ai` 表优先(v1.4.4)**:上游不可达 → `status=error`(不 abort);`agent`/`llm` 去 `json.set` 胶水 · [agent-llm-transport-soft-2026-10.md](doc/research/agent-llm-transport-soft-2026-10.md)
|
||||
- **Ext pack 1.4.3**:修复 `agent.run` cold EFI(`` `self`.preflight `` + miss resolve `llm_free`);已并入 **≥1.4.4** · [agent-run-efi-resolve-bugs-2026-10.md](doc/research/agent-run-efi-resolve-bugs-2026-10.md)
|
||||
@@ -183,7 +184,7 @@ marqdo catalog public -o .marqdo
|
||||
- **浏览器 Marqdo(WASM)**:`marqdo wasm build` + 官方 bridge 自启(作者零业务 JS;桥内可含列表/路由/storage/ws/文件/Canvas/音频/Observer/拖放);`lib/browser` + GFM;`web.client_embed`;示例 [browser-hello](examples/browser-hello/) · [browser-app](examples/browser-app/) · [browser-media](examples/browser-media/) · [web-client-site](examples/web-client-site/)([ADR 0002](doc/adr/0002-browser-marqdo-wasm.md) · [D](doc/roadmap/browser-wasm-d.md) · [E](doc/roadmap/browser-wasm-e.md) · [F](doc/roadmap/browser-wasm-f.md))
|
||||
- 选型:[ADR 0001 — Rust](doc/adr/0001-implementation-language.md) · [ADR 0002 — 浏览器 WASM](doc/adr/0002-browser-marqdo-wasm.md)(C0–C5 完结,见 [roadmap/browser-wasm.md](doc/roadmap/browser-wasm.md))· [ADR 0003 — 异步效应](doc/adr/0003-browser-async-effects.md)
|
||||
|
||||
### 如何使用最新 Marqdo(v1.4.5)
|
||||
### 如何使用最新 Marqdo(v1.4.6)
|
||||
|
||||
**安装解释器(任选其一)**
|
||||
|
||||
@@ -198,7 +199,7 @@ marqdo catalog public -o .marqdo
|
||||
```bash
|
||||
# 1) 源码安装(跟 tag 或 main)
|
||||
git clone https://github.com/cflmy/marqdo.git && cd marqdo
|
||||
git checkout v1.4.5 # 或留在 main
|
||||
git checkout v1.4.6 # 或留在 main
|
||||
cargo build --release
|
||||
export PATH="$PWD/target/release:$PATH"
|
||||
marqdo version
|
||||
@@ -237,7 +238,7 @@ marqdo wasm build
|
||||
# → dist/wasm/ … 见 examples/browser-hello/
|
||||
|
||||
# 6) Releases:Windows exe/zip/vsix;Linux CLI zip + native `.so` zip
|
||||
# https://github.com/cflmy/marqdo/releases/tag/v1.4.5
|
||||
# https://github.com/cflmy/marqdo/releases/tag/v1.4.6
|
||||
```
|
||||
|
||||
开发期也可用 `cargo run -- …` 代替已安装的 `marqdo`:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "marqdo-wasm"
|
||||
version = "1.4.5"
|
||||
version = "1.4.6"
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
description = "Marqdo interpreter as WebAssembly (browser host bridge)"
|
||||
|
||||
Vendored
+8
@@ -1,3 +1,11 @@
|
||||
marqdo (1.4.6-1ppa1) noble; urgency=medium
|
||||
|
||||
* Marqdo 1.4.6: Promote a bare self-increment to a required parameter.
|
||||
The first bold assignment LHS is a declaration (design §8.2); a missing
|
||||
argument reports missing argument for parameter, not undefined variable.
|
||||
|
||||
-- cflmy <pingan@cflmy.cn> Fri, 16 Oct 2026 23:56:00 +0800
|
||||
|
||||
marqdo (1.4.5-1ppa1) noble; urgency=medium
|
||||
|
||||
* Marqdo 1.4.5: Streamable HTTP MCP (agent_mcp_serve transport=http);
|
||||
|
||||
+85
-23
@@ -257,7 +257,7 @@ impl<'a> Cursor<'a> {
|
||||
var_contracts: std::collections::HashMap::new(),
|
||||
};
|
||||
// Prose decls pending promotion (name → optional default text).
|
||||
let mut prose_decls: Vec<(String, Option<String>)> = Vec::new();
|
||||
let mut prose_decls: Vec<(String, Option<String>, u32)> = Vec::new();
|
||||
|
||||
// Parameter zone: explicit `+` lines (legacy / optional).
|
||||
while self.skip_noise() {
|
||||
@@ -335,8 +335,8 @@ impl<'a> Cursor<'a> {
|
||||
for bit in bits {
|
||||
match bit {
|
||||
ProseBit::Decl { name, default, .. } => {
|
||||
if !prose_decls.iter().any(|(n, _)| n == &name) {
|
||||
prose_decls.push((name, default));
|
||||
if !prose_decls.iter().any(|(n, _, _)| n == &name) {
|
||||
prose_decls.push((name, default, span.line));
|
||||
}
|
||||
}
|
||||
ProseBit::BoldCode { inner, .. } => {
|
||||
@@ -1714,10 +1714,11 @@ fn stmt_from_italic_return(inner: &str, span: Span) -> Result<Stmt> {
|
||||
Ok(Stmt::Return { value, span })
|
||||
}
|
||||
|
||||
/// Merge prose decls into params: promote names that are read in the body (or have defaults).
|
||||
/// Merge declarations into params: promote names that are read in the body (or have defaults).
|
||||
///
|
||||
/// Design §8.2: elevate only when an executable read cannot be satisfied by a prior
|
||||
/// local assign that does not itself read the name (e.g. `score = > json.get …` is local;
|
||||
/// Design §8.2: a declaration is a backtick mention or the first bold assignment
|
||||
/// to that name. Elevate only when an executable read cannot be satisfied by a prior
|
||||
/// local assign that does not itself read the name (e.g. `score = 1` is local;
|
||||
/// `n = n + 1` still needs external `n`).
|
||||
// ---------- 契约提取(T2.1 · 渐进式契约 / 标注类型) ----------
|
||||
//
|
||||
@@ -1881,36 +1882,62 @@ fn extract_function_contract(fun: &mut Function, lines: &[ClassifiedLine]) -> Re
|
||||
|
||||
fn merge_inferred_params(
|
||||
fun: &mut Function,
|
||||
prose_decls: &[(String, Option<String>)],
|
||||
prose_decls: &[(String, Option<String>, u32)],
|
||||
) -> Result<()> {
|
||||
use std::collections::HashSet;
|
||||
|
||||
let mut needs_input = HashSet::new();
|
||||
let mut bound = HashSet::new();
|
||||
collect_names_needing_input(&fun.body, &mut bound, &mut needs_input);
|
||||
let mut assign_decls = Vec::new();
|
||||
collect_names_needing_input(
|
||||
&fun.body,
|
||||
&mut bound,
|
||||
&mut needs_input,
|
||||
&HashSet::new(),
|
||||
&mut assign_decls,
|
||||
);
|
||||
|
||||
for (name, default_txt) in prose_decls {
|
||||
// Declaration order is source order: backtick mentions and first assignment
|
||||
// left-hand sides. An assignment promotes only when its right-hand side (or a
|
||||
// later read) still needs an external value.
|
||||
let mut events: Vec<(u32, usize, String, Option<String>)> = Vec::new();
|
||||
for (i, (name, default_txt, line)) in prose_decls.iter().enumerate() {
|
||||
events.push((*line, i, name.clone(), default_txt.clone()));
|
||||
}
|
||||
let prose_n = events.len();
|
||||
for (j, (name, line)) in assign_decls.iter().enumerate() {
|
||||
if prose_decls.iter().any(|(n, _, _)| n == name) {
|
||||
continue;
|
||||
}
|
||||
if !needs_input.contains(name) {
|
||||
continue;
|
||||
}
|
||||
events.push((*line, prose_n + j, name.clone(), None));
|
||||
}
|
||||
events.sort_by_key(|e| (e.0, e.1));
|
||||
|
||||
for (_line, _ord, name, default_txt) in events {
|
||||
if name == "self" || name == "自" {
|
||||
continue;
|
||||
}
|
||||
if fun.params.iter().any(|p| &p.name == name) {
|
||||
if fun.params.iter().any(|p| p.name == name) {
|
||||
continue;
|
||||
}
|
||||
let has_default = default_txt.is_some();
|
||||
// Elevate: defaulted always; or executable read that needs an external input.
|
||||
if !has_default && !needs_input.contains(name) {
|
||||
if !bound.contains(name) {
|
||||
fun.dead_binds.push(name.clone());
|
||||
if !has_default && !needs_input.contains(&name) {
|
||||
if !bound.contains(&name) {
|
||||
fun.dead_binds.push(name);
|
||||
}
|
||||
continue; // dead bind or pure local
|
||||
}
|
||||
let default = if let Some(txt) = default_txt {
|
||||
Some(parse_expr_prefer_var(txt).or_else(|_| parse_value_or_interp(txt))?)
|
||||
Some(parse_expr_prefer_var(&txt).or_else(|_| parse_value_or_interp(&txt))?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
fun.params.push(Param {
|
||||
name: name.clone(),
|
||||
name,
|
||||
default,
|
||||
inferred: true,
|
||||
});
|
||||
@@ -1921,21 +1948,30 @@ fn merge_inferred_params(
|
||||
/// Walk body in order. `bound` = names already assigned locally without needing input.
|
||||
/// On read of unbound name → needs input. On assign, RHS reads are checked first
|
||||
/// (so `n = n + 1` marks `n` as needing input before binding).
|
||||
/// `assign_decls` records the first assignment of each name, which §8.2 treats as
|
||||
/// a declaration when no backtick mention came first. Loop items are not declarations.
|
||||
fn collect_names_needing_input(
|
||||
stmts: &[Stmt],
|
||||
bound: &mut std::collections::HashSet<String>,
|
||||
needs: &mut std::collections::HashSet<String>,
|
||||
loop_items: &std::collections::HashSet<String>,
|
||||
assign_decls: &mut Vec<(String, u32)>,
|
||||
) {
|
||||
for s in stmts {
|
||||
match s {
|
||||
Stmt::Assign { name, value, .. } => {
|
||||
Stmt::Assign { name, value, span, .. } => {
|
||||
let mut rhs_reads = std::collections::HashSet::new();
|
||||
collect_reads_expr(value, &mut rhs_reads);
|
||||
for r in &rhs_reads {
|
||||
if !bound.contains(r) {
|
||||
if !bound.contains(r) && !loop_items.contains(r) {
|
||||
needs.insert(r.clone());
|
||||
}
|
||||
}
|
||||
if !loop_items.contains(name)
|
||||
&& !assign_decls.iter().any(|(n, _)| n == name)
|
||||
{
|
||||
assign_decls.push((name.clone(), span.line));
|
||||
}
|
||||
bound.insert(name.clone());
|
||||
}
|
||||
Stmt::Return { value, .. } => {
|
||||
@@ -1977,7 +2013,13 @@ fn collect_names_needing_input(
|
||||
}
|
||||
}
|
||||
let mut arm_bound = bound.clone();
|
||||
collect_names_needing_input(&a.body, &mut arm_bound, needs);
|
||||
collect_names_needing_input(
|
||||
&a.body,
|
||||
&mut arm_bound,
|
||||
needs,
|
||||
loop_items,
|
||||
assign_decls,
|
||||
);
|
||||
}
|
||||
}
|
||||
Stmt::While {
|
||||
@@ -1986,19 +2028,24 @@ fn collect_names_needing_input(
|
||||
let mut reads = std::collections::HashSet::new();
|
||||
collect_reads_expr(condition, &mut reads);
|
||||
for r in reads {
|
||||
if !bound.contains(&r) {
|
||||
if !bound.contains(&r) && !loop_items.contains(&r) {
|
||||
needs.insert(r);
|
||||
}
|
||||
}
|
||||
collect_names_needing_input(body, bound, needs);
|
||||
collect_names_needing_input(body, bound, needs, loop_items, assign_decls);
|
||||
}
|
||||
Stmt::ForEach {
|
||||
collection, body, ..
|
||||
item,
|
||||
collection,
|
||||
body,
|
||||
..
|
||||
} => {
|
||||
if !bound.contains(collection) {
|
||||
if !bound.contains(collection) && !loop_items.contains(collection) {
|
||||
needs.insert(collection.clone());
|
||||
}
|
||||
collect_names_needing_input(body, bound, needs);
|
||||
let mut nested = loop_items.clone();
|
||||
nested.insert(item.clone());
|
||||
collect_names_needing_input(body, bound, needs, &nested, assign_decls);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2391,6 +2438,21 @@ Candidates may include lexical `score`.
|
||||
assert!(!dump.contains("dead="), "{dump}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_bare_inc_is_required_param() {
|
||||
// §8.2: the first bold assignment is a declaration. The RHS reads `n`
|
||||
// before the bind, so `n` is a required parameter even without a backtick.
|
||||
let src = "## inc\n\n**n = n + 1**\n*n*\n\n# main\n\n**print text=\"ok\"**\n";
|
||||
let m = parse_source(src).unwrap();
|
||||
let inc = m.functions.iter().find(|f| f.name == "inc").unwrap();
|
||||
assert_eq!(
|
||||
inc.params.iter().map(|p| p.name.as_str()).collect::<Vec<_>>(),
|
||||
["n"]
|
||||
);
|
||||
assert!(inc.params[0].default.is_none());
|
||||
assert!(inc.params[0].inferred);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_dead_binds_visible_in_ast_dump() {
|
||||
let src = include_str!("../../tests/markup-v03/dead-bind.mq.md");
|
||||
|
||||
Reference in new issue
Block a user