Compare commits
10
Commits
7ee200d921
...
17f16a6bfc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17f16a6bfc | ||
|
|
4e70a5889e | ||
|
|
e9a7fc73ee | ||
|
|
d0c1dccffd | ||
|
|
5bb0e9d21d | ||
|
|
e426998cf7 | ||
|
|
1dc0550659 | ||
|
|
a354958599 | ||
|
|
85cdb94dc9 | ||
|
|
ddbe5f167d |
No files matched your search
@@ -38,7 +38,7 @@ Guessing, inventing data, or shipping a toy is always the wrong answer.
|
||||
## What this is
|
||||
|
||||
A local desktop CLI agent whose entire control flow is a single decision model
|
||||
(SemIf). Inputs are scored for urgency, queued, and dispatched through a
|
||||
(SemIf). Inputs are queued FIFO and dispatched through a
|
||||
skill tree. Nothing is gated out up front: every input is dispatched and inputs
|
||||
that are not requests fall through navigation into the closed `response` tree of
|
||||
canned replies (a request no skill covers authors a skill instead — the
|
||||
@@ -66,10 +66,10 @@ cli.py argparse: run (REPL / --script), dream, skills, status, relabel,
|
||||
dashboard, gateway (command intake), bridge (standalone
|
||||
third-party API bridges)
|
||||
scheduler.py no up-front gate: every input is dispatched
|
||||
-> choice(tau) -> score -> queue; preempt + requeue;
|
||||
a skill run paused for input (needs_input) keeps `current`
|
||||
busy; `answer` routes straight to the pending run, bypassing
|
||||
gate/score/navigation; draft authoring (title+description by the
|
||||
-> FIFO queue when busy; a skill run paused for input
|
||||
(needs_input) keeps `current` busy; `answer` routes straight to
|
||||
the pending run, bypassing the queue/navigation; draft authoring
|
||||
(title+description by the
|
||||
small `llm` provider) AND skill-body authoring (codegen) are ASYNC
|
||||
single-slot workers: a create_category/create_skill request is
|
||||
queued, the gate stays free, the category job chains into its
|
||||
@@ -92,8 +92,11 @@ scheduler.py no up-front gate: every input is dispatched
|
||||
housekeeping meta skills (delete/clear-config/regen/cancel-build)
|
||||
operate on the tree via `ctx.admin`; per-category new-skill locks
|
||||
(`locks.new_skill` in the category config) gate creation, with
|
||||
`housekeeping`/`response` hard-locked in code
|
||||
queue.py urgency max-heap (desc weight, FIFO seq), age pulls toward 1.0
|
||||
`housekeeping`/`response` hard-locked in code; front ends get a
|
||||
structured `SchedulerReply` (status, text, run_id, skill_ref,
|
||||
result) from `submit_request`/`answer`/`run_queue` so they never
|
||||
parse the run id or skill ref back out of the summary
|
||||
queue.py bounded FIFO request queue (arrival order, max depth)
|
||||
skills.py tree + registry (hardcoded built-ins: the closed `response` canned
|
||||
tree plus the `housekeeping` meta skills), navigation = SemIf
|
||||
choices per level (logged;
|
||||
@@ -127,7 +130,8 @@ skill.py loop: observe -> act -> observe -> assess; the body is a single
|
||||
assess is a SemIf decision (`assess:outcome` success/failure at
|
||||
tau; on failure `assess:requeue` complete/retry) and the run
|
||||
summary is deterministic (no generation), built from
|
||||
category.skill + ok/failed + action_log; the assess state carries
|
||||
category.skill + ok/failed + action_log — the body writes only the
|
||||
result, the runner adds the `category.name:` ref; the assess state carries
|
||||
the resolved inputs (secrets redacted); a `DETERMINISTIC_CATEGORIES`
|
||||
run (housekeeping) skips assessment/repair — it is an internal
|
||||
mechanical action with a known result, not an external run;
|
||||
@@ -143,7 +147,10 @@ timers.py in-process timer/alarm service (TimerService) owned by the
|
||||
the gateway routes it to the originating chat, the dashboard
|
||||
shows pending/fired). Real local compute (`compute` transport),
|
||||
per-process, and deliberately NOT persisted across restarts.
|
||||
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import)
|
||||
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import);
|
||||
call() scores a decision, generate() autoregressively samples
|
||||
text from the same loaded model (shares the engine lock, clears
|
||||
the KV cache) — backs the `semif` llm provider
|
||||
codegen.py CodegenClient (OpenAI-compatible) writes real-integration skill
|
||||
bodies against CODEGEN.md (real actions via stdlib transports,
|
||||
data from the runner via ctx.config, never embedded; bodies
|
||||
@@ -169,12 +176,16 @@ llm.py small OpenAI-compatible provider (LLMClient) that authors a
|
||||
new category/skill title + description — its own endpoint/model,
|
||||
deliberate separate from codegen; provider logic (SSE/budget/idle)
|
||||
is shared from provider.py; `_parse_json` is also borrowed by the
|
||||
authoring parsers
|
||||
authoring parsers; SemIfLLMClient serves the same `llm` task from
|
||||
the loaded SemIf engine model (llm.provider == "semif")
|
||||
provider.py shared OpenAI-compatible chat transport (OpenAICompatClient:
|
||||
SSE stream, token budget, idle watchdog, degeneration hook,
|
||||
optional `api_key` bearer auth + `extra_headers`/`user_agent`,
|
||||
and `query_context` to skip the ollama /api/show probe)
|
||||
subclassed by llm.LLMClient and codegen.CodegenClient
|
||||
subclassed by llm.LLMClient and codegen.CodegenClient;
|
||||
SemIfEngineClient is the non-HTTP sibling that generates text
|
||||
from the in-process SemIf engine behind the same `chat(...)`
|
||||
surface (llm.provider == "semif")
|
||||
console.py OpenCode Console provider: OpenCodeConsoleClient + the
|
||||
ConsoleLLMClient / ConsoleCodegenClient endpoint subclasses.
|
||||
Hosted, authenticated OpenAI-compatible Chat Completions API
|
||||
@@ -183,11 +194,12 @@ console.py OpenCode Console provider: OpenCodeConsoleClient + the
|
||||
urllib's default Python-urllib/<ver>), and forces
|
||||
disable_thinking off (the gateway 400s reasoning_effort).
|
||||
Selected via the llm/codegen `provider` key
|
||||
("opencode" vs "ollama").
|
||||
("opencode" vs "ollama"; `llm` also accepts "semif", the
|
||||
in-process engine model).
|
||||
log.py decisions.jsonl rows {state, question, options, predicted_probs,
|
||||
selected, observed_outcome, label_source}
|
||||
trace.py runs.jsonl lifecycle events keyed by run_id (submit/queued/
|
||||
preempted/assessed/...); decisions reference run_id in extra
|
||||
dequeued/assessed/...); decisions reference run_id in extra
|
||||
dream.py NLL of observed outcome per row; weighted CE, accuracy, ECE
|
||||
decisions.py contract dataclasses (Option, DecisionRequest, DecisionResult,
|
||||
Request)
|
||||
@@ -210,7 +222,12 @@ gateway/ messenger COMMAND intake/reply — and nothing else. base.py:
|
||||
speech-to-text + text-to-speech) over the neutral
|
||||
`semif_agent/voice_transport.py`; no remote peer and no
|
||||
allowlist (physical mic access is the authorization), a single
|
||||
configured `chat_id`, replies spoken back. Run with
|
||||
configured `chat_id`, replies spoken back. humanize.py:
|
||||
Humanizer — optional LLM cleanup of a result line (generation,
|
||||
never a decision; grounded prompt + always falls back to the
|
||||
raw text), gated by `gateway.humanize` / a per-platform
|
||||
`humanize` override, reusing the scheduler's `llm` client with
|
||||
a short per-call timeout. Run with
|
||||
`python -m semif_agent.cli gateway [--platform
|
||||
simplex,lxmf,voice|all] [--dashboard]`; config under
|
||||
`gateway.simplex` / `gateway.lxmf` / `gateway.voice`. The
|
||||
@@ -292,7 +309,7 @@ values are yours to choose.
|
||||
## Roadmap
|
||||
|
||||
### v1 (done)
|
||||
Core loop, urgency queue, skill tree, skill loop with real SemIf assessment
|
||||
Core loop, FIFO queue, skill tree, skill loop with real SemIf assessment
|
||||
(decision, not generation), decision logging, `dream` cost pass, REPL + JSONL
|
||||
CLI, unit tests (24) + integration tests (2).
|
||||
|
||||
@@ -369,7 +386,7 @@ CLI, unit tests (24) + integration tests (2).
|
||||
skip their softmax.
|
||||
- **No handle/ignore gate; the `response` tree is the non-request catchall**
|
||||
(Sep 2026; actionability guard Oct 2026): the top-level `_contains_request`
|
||||
handle/ignore gate is gone. Every input is scored and dispatched; input that
|
||||
handle/ignore gate is gone. Every input is dispatched; input that
|
||||
is not a request falls through navigation into the closed `response` category,
|
||||
a hardcoded tree of canned replies (`response.greeting`, `response.thanks`,
|
||||
`response.acknowledge`, `response.farewell`, `response.affirm`, and the
|
||||
@@ -485,7 +502,7 @@ CLI, unit tests (24) + integration tests (2).
|
||||
- **Messenger gateway (SimpleX first, then LXMF)** (Sep 2026; LXMF Oct 2026):
|
||||
`python -m semif_agent.cli gateway` runs a dedicated process that connects to
|
||||
one or more transports and feeds authorized DM text through the normal
|
||||
gate/score/queue/dispatch pipeline; results, authoring questions, and repair
|
||||
queue/dispatch pipeline; results, authoring questions, and repair
|
||||
offers are sent back to the originating chat. `gateway/base.py` is the
|
||||
transport contract (`GatewayAdapter`, `InboundMessage`, `OutboundMessage`),
|
||||
`gateway/service.py` the platform-aware scheduler glue (single execution slot,
|
||||
@@ -531,15 +548,37 @@ CLI, unit tests (24) + integration tests (2).
|
||||
- Calibration: SemIf ships per-workload temperature scaling; adopt it before
|
||||
treating probabilities as confidence.
|
||||
- Enumerate the intake source taxonomy and per-source gating.
|
||||
- **Decision-engine latency.** A single SemIf forward pass over a small prompt
|
||||
can take seconds on CPU, and a trivial request pays several of them
|
||||
(actionability + category + scope + leaf + intent + assess), so routing and
|
||||
assessment dominate end-to-end agent latency — not audio I/O (STT/TTS are
|
||||
sub-second) and not the network. Before treating latency as a front-end
|
||||
problem, profile the engine: confirm thread utilization, whether the cost is
|
||||
prefill vs. per-option scoring, and whether a smaller/faster decision model or
|
||||
a shared-state (`score_shared`) path helps. `decision extra.timing`
|
||||
(`input_tokens`/`forward_seconds`/`total_seconds`) and the voice latency
|
||||
breakdown (`scripts/voice-latency.py`) are the measurement hooks.
|
||||
|
||||
## Constraints & gotchas (learned the hard way)
|
||||
|
||||
### Environment
|
||||
- The core is pure stdlib and runs anywhere Python does. Never pip-install heavy
|
||||
deps on a thin client; a full install belongs on a provisioned host.
|
||||
- The SemIf engine runs via llama.cpp **CPU** backend (its llamacpp backend
|
||||
forces `n_gpu_layers=0`), so the decision engine does not use a GPU; ollama
|
||||
does.
|
||||
- The SemIf engine runs via llama.cpp. It is **CPU by default**: SemIf's
|
||||
llamacpp backend hardcodes `n_gpu_layers=0`. Setting `engine.gpu_layers` in
|
||||
config.json offloads to a GPU when llama-cpp-python was built with a GPU
|
||||
backend (Vulkan/ROCm/CUDA). The agent wraps the backend's `_cpu_model_params`
|
||||
so the knob works without patching the re-cloned engine source, and on the GPU
|
||||
path also forces a full cache reset (`llama_memory_clear(mem, True)`): SemIf's
|
||||
metadata-only clear leaves stale hybrid-attention state on Vulkan, so repeated
|
||||
scores drift otherwise. **A GPU build is opt-in** — llama.cpp's Vulkan backend
|
||||
splits the graph across CPU and GPU even at `n_gpu_layers=0`, roughly halving
|
||||
CPU throughput, so a CPU-only host must not get one (`bootstrap.sh --gpu
|
||||
vulkan|rocm|cuda`, or set `engine.gpu_layers` and rerun, builds it; the default
|
||||
stays CPU-only). Offload needs the accelerator **to itself**: the 4B Q4 model
|
||||
needs ~2.9 GiB, so a GPU already holding another model (e.g. ollama) makes the
|
||||
engine slower than CPU and can abort the process with `vk::DeviceLostError`.
|
||||
ollama is a separate GPU user.
|
||||
- The SemIf tokenizer is fetched from HF (`Qwen/Qwen3.5-4B` at the pinned
|
||||
revision), cached under each checkout's `.runtime/hf` (`HF_HOME`).
|
||||
- Per-host specs and model choices for this deployment: `local/ENVIRONMENT.md`.
|
||||
@@ -557,7 +596,12 @@ CLI, unit tests (24) + integration tests (2).
|
||||
`pip install -e <semif-clone> --no-deps`, then
|
||||
`CMAKE_BUILD_PARALLEL_LEVEL=6 MAKEFLAGS=-j6 pip install -r requirements/staging.txt`
|
||||
(numpy 2.3.5, transformers 5.17.0, tokenizers 0.23.2, huggingface-hub 1.31.0,
|
||||
llama-cpp-python 0.3.35, pytest).
|
||||
llama-cpp-python 0.3.35, pytest). GPU offload is **opt-in**: set
|
||||
`engine.gpu_layers` and run `bootstrap.sh --gpu vulkan|rocm|cuda` (with
|
||||
`--gpu auto`, detection picks a backend when `engine.gpu_layers` is set),
|
||||
which installs the Vulkan build prereqs
|
||||
(`libvulkan-dev glslc spirv-headers glslang-tools`) when needed. A CPU-only
|
||||
host keeps the default CPU wheel — a GPU build is slower on CPU.
|
||||
- **Expected pip warnings:** pip reports "dependency conflicts" against
|
||||
semif-phase1's declared requirements (torch/accelerate/protobuf/sentencepiece
|
||||
not installed, numpy 2.2.6 vs 2.3.5). These are informational — the staging
|
||||
@@ -568,7 +612,11 @@ CLI, unit tests (24) + integration tests (2).
|
||||
gcc (`internal compiler error: Segmentation fault`). Limit parallelism:
|
||||
`CMAKE_BUILD_PARALLEL_LEVEL=6 MAKEFLAGS=-j6 pip install llama-cpp-python==0.3.35`.
|
||||
Do NOT bump the llama-cpp-python version — SemIf calls specific llama.cpp C
|
||||
APIs that change between versions.
|
||||
APIs that change between versions. **GPU builds:** pip's wheel cache serves the
|
||||
prebuilt CPU wheel even when `CMAKE_ARGS` requests a GPU backend, so force a
|
||||
real source build with
|
||||
`--force-reinstall --no-cache-dir --no-binary llama-cpp-python` (bootstrap does
|
||||
this when the installed build reports no GPU offload).
|
||||
- The pinned GGUF: `Qwen3.5-4B-Q4_K_M.gguf` from bartowski (2.8G), downloaded
|
||||
into `.runtime/models/` by bootstrap. Load ~34s; score ~0.9s/decision on CPU
|
||||
at 8 threads.
|
||||
@@ -670,6 +718,21 @@ CLI, unit tests (24) + integration tests (2).
|
||||
larger/slower than `llm`). Title + description for new skills come from the
|
||||
separate small `llm` provider (its own endpoint/model, shared transport in
|
||||
`provider.py`); only the runnable code body uses codegen.
|
||||
- **Local engine as the `llm` provider: `"semif"`** (`provider.SemIfEngineClient`
|
||||
+ `llm.SemIfLLMClient`). Set `llm.provider = "semif"` to generate the
|
||||
title/description (and any other `llm` text: gateway result cleanup, the LLM
|
||||
bridge) from the **already-loaded SemIf decision model** in-process, with no
|
||||
ollama endpoint and no `llm.model` — the pinned GGUF is the model. `engine.
|
||||
SemIfEngine.generate` autoregressively samples through the backend's low-level
|
||||
llama.cpp context (chat template with `enable_thinking=False`, KV cache
|
||||
cleared), holding the same lock as `call`, so a reply briefly serializes
|
||||
against routing/assessment on the one loaded model. The adapter is a drop-in
|
||||
sibling of `OpenAICompatClient` (same `chat(messages, max_tokens=...,
|
||||
temperature=..., ...)` surface; HTTP-only args accepted and ignored) and
|
||||
raises `LLMError` on any engine failure, so the scheduler's graceful
|
||||
`draft_failed` path and the LLM bridge's 502 path are unchanged. Knobs:
|
||||
`llm.semif.temperature` (0 = greedy) and `llm.semif.max_tokens`. Only the
|
||||
`llm` task supports it (codegen still needs a real code model).
|
||||
- **Alternate hosted provider: OpenCode Console** (`console.py`). Either
|
||||
endpoint can run against the hosted, authenticated OpenAI-compatible Console
|
||||
inference API instead of local ollama: set `llm.provider` / `codegen.provider`
|
||||
@@ -731,7 +794,13 @@ CLI, unit tests (24) + integration tests (2).
|
||||
bridge) and `simplex.connect_link` (show/create the forwarding bot's contact
|
||||
link) are the messenger seeds; `time.now`, `time.date`, `time.set_timer`, and
|
||||
`time.set_alarm` are the local time utilities (`compute` transport, empty
|
||||
contract) — they read the host clock and schedule on `ctx.timers`;
|
||||
contract) — they read the host clock and schedule on `ctx.timers`. Local time
|
||||
is the top-level `timezone` config value (an IANA name such as
|
||||
`America/Chicago`; `timers.local_now`/`resolve_timezone` resolve it via
|
||||
`zoneinfo`), falling back to the host's own timezone when it is empty or
|
||||
unknown; `TimerService` formats due/fired times in that zone too. The calendar
|
||||
seeds derive "now" the same way, so a request time is parsed in the user's
|
||||
zone rather than the host's;
|
||||
`tests/test_seed_skills.py` keeps them honest.
|
||||
- **Contract provenance.** Each authored body records the CODEGEN.md revision it
|
||||
was written against. `skill_contract_ref()` (`codegen.py`) returns
|
||||
@@ -786,8 +855,8 @@ CLI, unit tests (24) + integration tests (2).
|
||||
rides in the code), the error + existing files are fed back, bounded by
|
||||
`codegen.test_max_attempts`.
|
||||
On success the body is materialized (`materialize_skill`), hot-merged, the
|
||||
leaf's `writing` flag clears, and the **original request is re-queued** at its
|
||||
scored weight and re-runs navigation onto the new leaf (`skill_requeued`). On
|
||||
leaf's `writing` flag clears, and the **original request is re-queued** and
|
||||
re-runs navigation onto the new leaf (`skill_requeued`). On
|
||||
failure (`CodegenError`/`ValueError`) the user is notified, the leaf stays a
|
||||
restartable stub, and the request is NOT re-dispatched. A re-dispatched
|
||||
request whose skill is still unwritten reports the pending write instead of
|
||||
@@ -1010,7 +1079,7 @@ CLI, unit tests (24) + integration tests (2).
|
||||
wake (optionally again on transcription) so the user knows they were heard.
|
||||
**Result-only output**: `VoiceAdapter.result_only` (default true; per-platform
|
||||
config `result_only` overrides) makes `GatewayService` speak just the skill's
|
||||
result line — queue/urgency chatter is dropped and the `<skill>: ok —` wrapper
|
||||
result line — scheduler bookkeeping is dropped and the `<skill>: ok —` wrapper
|
||||
is stripped — so the spoken output is the answer, not the scheduler's
|
||||
internals. Questions, repair offers, approvals, and timer notifications are
|
||||
still spoken.
|
||||
@@ -1032,7 +1101,7 @@ CLI, unit tests (24) + integration tests (2).
|
||||
ownership across an updated request so its completion still routes home. A
|
||||
`needs_input` pause sets `pending_owner` from the pending run's source; the
|
||||
same chat's next message goes straight to `Scheduler.answer` (no
|
||||
score/navigation). A *different* chat — **including a chat on another
|
||||
queue/navigation). A *different* chat — **including a chat on another
|
||||
platform** — during that pause is told to wait: the single-slot scheduler must
|
||||
not silently abandon the first chat's run, and one service fronts all
|
||||
adapters so the guard spans them. A background poll calls
|
||||
@@ -1041,6 +1110,33 @@ CLI, unit tests (24) + integration tests (2).
|
||||
= True`; the service routes them by `run_id` → `(platform, chat)`, falling
|
||||
back to that platform's `home_channel`); a chat's plain reply answers the
|
||||
question or picks the repair action (`retry`/`repair`/`ask`/`no`).
|
||||
- **Optional result cleanup** (`gateway/humanize.py`): a gateway-only
|
||||
presentation layer that rewrites a completed skill's result line from the
|
||||
scheduler's deterministic `<skill>: <ok|failed> — <action_log>` into one
|
||||
grounded, friendly sentence. It is **generation, never a decision** — the
|
||||
success/failure verdict and routing are already settled by SemIf and the
|
||||
runner, and the rewrite is never fed back into assessment, tracing, or the
|
||||
decision log (the runner and REPL keep the raw deterministic summary). The
|
||||
prompt forbids adding/inferring/dropping facts, and `Humanizer.humanize`
|
||||
always falls back to the original text on any error, timeout, empty/refusal
|
||||
reply, or runaway length, so a cleanup failure never swallows a real result.
|
||||
It reuses the scheduler's `llm` client (endpoint/model/sampler configured
|
||||
once) with a short per-call `timeout` (a new optional `chat()` argument) so a
|
||||
slow cleanup cannot hold the gateway poll loop for the authoring budget. Off
|
||||
by default: `gateway.humanize` (`enabled`/`timeout`/`max_tokens`/`max_chars`)
|
||||
sets the global default and a per-platform `gateway.<platform>.humanize`
|
||||
bool/`{enabled}` overrides it. A **skill's own recorded config**
|
||||
(`data/skills/<category>/<name>/config.json` -> `{"humanize": bool}`) wins
|
||||
over both, so a skill whose result is already speakable (e.g. `time.now`)
|
||||
skips the rewrite while a mechanical one keeps it; the gateway reads the
|
||||
skill ref from the structured `SchedulerReply.skill_ref` (the scheduler's
|
||||
`run_queue`/`submit_request`/`answer` carry `run_id`, `skill_ref`, and the
|
||||
unwrapped `result` alongside the human-facing `text` — no parsing it back out
|
||||
of the summary). Only `kind == "result"`
|
||||
lines are touched
|
||||
(questions, repair/approval notices, and status chatter pass through); like
|
||||
`result_only`, an enabled platform unwraps the result detail before cleaning.
|
||||
`_resolve_platforms` skips the reserved `humanize` key.
|
||||
- **Gateway isolation (non-negotiable).** The gateway exists only to take
|
||||
commands and send replies. It MUST NOT read a contact's history, show/create
|
||||
invite links, or compose messages on the user's behalf: no `observer`, no
|
||||
@@ -1061,6 +1157,10 @@ CLI, unit tests (24) + integration tests (2).
|
||||
allowlist/auth and batching (a `threading.Timer`), cross-platform pending-run
|
||||
guard and per-platform reply routing, and `GatewayService` routing against a
|
||||
real `Scheduler` (lazy engine, unreachable LLM).
|
||||
`tests/test_humanize.py` covers the optional result cleanup with an injected
|
||||
fake `llm` client (rewrite, quote/whitespace normalization, fallback on
|
||||
error/empty/refusal/runaway, disabled passthrough, and the global +
|
||||
per-platform gateway enable/disable wiring).
|
||||
`tests/test_lxmf_transport.py` covers the neutral LXMF transport's
|
||||
missing-dep contract, default paths, and `normalize_message` (no real `lxmf`
|
||||
needed). `tests/test_simplex_ws.py` covers the neutral protocol layer (parse
|
||||
@@ -1214,9 +1314,9 @@ The bridge read path (`simplex.next_message`) and contact-link lookup
|
||||
- Navigation decisions ARE logged (`navigate:category`, `navigate:leaf` in
|
||||
skills.py) and therefore count toward dream cost. This is intended per the
|
||||
design; don't silently drop them.
|
||||
- Queue ordering: urgency desc, then FIFO (`seq`). Recency is stored but is NOT
|
||||
in the sort key (it's anti-correlated with FIFO). Ageing pulls weights toward
|
||||
the max (1.0) so low items catch up; uniform additive boosts do nothing.
|
||||
- Queue ordering: strict FIFO (arrival order). There is no urgency score and no
|
||||
preemption; the running process always finishes before the next queued request
|
||||
is dispatched.
|
||||
- The decision engine is always real and every `EngineUnavailable` is **fatal**:
|
||||
`submit` records it (`("fatal", ...)`), the scheduler exposes `fatal`, and the
|
||||
CLI prints it and exits non-zero. There is no degraded/soft-error path.
|
||||
|
||||
+9
-1
@@ -418,11 +418,19 @@ happened:
|
||||
|
||||
Rules:
|
||||
|
||||
- **Do not prefix the skill name to `action_log` or `new_state`.** The runner
|
||||
wraps the result in the deterministic summary (`category.name: ok — <detail>`)
|
||||
and carries the skill ref structurally, so a body writes only the result text
|
||||
— never `"<category>.<name>: ..."`.
|
||||
- **Return the real result.** A read/query skill returns the data it fetched; an
|
||||
action skill reports the service's real response. A generic "done" that omits
|
||||
the result is a broken output.
|
||||
- **Never an empty or placeholder output.** If there is genuinely nothing (empty
|
||||
inbox, no matching event), say so explicitly — that is a real result.
|
||||
inbox, no matching event), say so explicitly — that is a real result, and a
|
||||
**successful** run: the `assess:outcome` step treats a definitive "nothing
|
||||
found / nothing to do" result as success. Phrase it as the answer the user
|
||||
asked for ("checked the inbox: no unread messages"), not as an absence or an
|
||||
error, so the assessment does not read a healthy empty result as a failure.
|
||||
- **Never claim success you did not observe.** If the action failed, put the
|
||||
real failure in `action_log` and set `new_state` back to `request.text` (see
|
||||
the hard requirements).
|
||||
|
||||
@@ -17,7 +17,7 @@ A successful release of this could be defined by a single question: "Can I use t
|
||||
|
||||
- [Why this exists (the reasoning)](#why-this-exists-the-reasoning)
|
||||
- [How it works](#how-it-works)
|
||||
- [The scheduler: choose, score, queue, dispatch](#the-scheduler-choose-score-queue-dispatch)
|
||||
- [The scheduler: queue and dispatch](#the-scheduler-queue-and-dispatch)
|
||||
- [The skill tree and navigation](#the-skill-tree-and-navigation)
|
||||
- [The skill run loop](#the-skill-run-loop)
|
||||
- [Authoring a new skill](#authoring-a-new-skill)
|
||||
@@ -70,7 +70,7 @@ model entirely:
|
||||
does.)
|
||||
- **Simulated Agile patterns.** A skill is a real integration into the active tool chain for end user satisfaction. It takes existing mail
|
||||
protocols, SimpleX, CalDAV/WebDAV, configured local CLIs, HTTP APIs and your supplied data to produce actions that best fit your query. In the absence of a an existing skill, the skill generation process is activated. Skill generation has four major phases - definition, refinement, coding, testing (unit and integration). Each step in this process has deterministic and probabilistic handling optimized to achieve the stated goal of the user in the context of the platform's core mission.
|
||||
- **Nothing is gated out up front.** Every input is dispatched and scored.
|
||||
- **Nothing is gated out up front.** Every input is dispatched.
|
||||
Inputs that are not requests fall through navigation into the closed `response`
|
||||
category — a hardcoded tree of canned replies (`greeting`, `thanks`,
|
||||
`acknowledge`, `farewell`, `affirm`, and the catchall `clarify`). A request no
|
||||
@@ -88,25 +88,23 @@ model entirely:
|
||||
|
||||
## How it works
|
||||
|
||||
### The scheduler: choose, score, queue, dispatch
|
||||
### The scheduler: queue and dispatch
|
||||
|
||||
Implemented in `semif_agent/scheduler.py` and `semif_agent/queue.py`:
|
||||
|
||||
```
|
||||
intake (typed input / messenger gateway / scripted)
|
||||
└─ choice "should this interrupt the current process?" (SemIf)
|
||||
├─ yes → preempt current, requeue it with state preserved
|
||||
└─ no → score "how urgent?" critical/high/medium/low (SemIf)
|
||||
└─ urgency priority queue (weight desc, then FIFO)
|
||||
├─ idle → dispatch immediately
|
||||
└─ busy → FIFO queue (arrival order, no priority)
|
||||
```
|
||||
|
||||
- The **queue** is a max-heap by urgency weight, FIFO within equal weight, with
|
||||
upward ageing so low-priority items cannot starve (`queue.py`).
|
||||
- The **queue** is a strict first-in-first-out list of pending requests with a
|
||||
maximum depth (`queue.py`). There is no urgency scoring and no preemption.
|
||||
- A **skill run paused for input** (`needs_input`) keeps the current slot busy;
|
||||
an answer routes straight back to the pending run, bypassing
|
||||
choice/score/navigation.
|
||||
- A high-priority input can preempt the running process, which re-queues with its
|
||||
state preserved.
|
||||
an answer routes straight back to the pending run, bypassing the queue and
|
||||
navigation.
|
||||
- The running process always finishes before the next queued request is
|
||||
dispatched.
|
||||
- Exactly one execution slot. (Concurrency, when it comes, is SemIf's
|
||||
shared-state mode for parallel *decisions* — not parallel process execution.)
|
||||
|
||||
@@ -200,9 +198,9 @@ worker. It is **asynchronous**, so the gate stays free while either model thinks
|
||||
`codegen.test_max_attempts`.
|
||||
|
||||
On success the body materializes to `data/skills/<category>/<name>/`, is
|
||||
hot-merged, and **the original request is re-queued** at its scored weight and
|
||||
re-runs navigation onto the new leaf. On failure the leaf stays a restartable
|
||||
stub. A whole new category runs the same chain deterministically:
|
||||
hot-merged, and **the original request is re-queued** and re-runs navigation
|
||||
onto the new leaf. On failure the leaf stays a restartable stub. A whole new
|
||||
category runs the same chain deterministically:
|
||||
`create_category` → `create_skill` → async body → re-dispatch.
|
||||
|
||||
A rejected/simulated body is traced (`fidelity_review`), badged `unverified`,
|
||||
@@ -230,8 +228,6 @@ the request, the tree, the elicitation answers, the runtime **bridge catalog**
|
||||
|
||||
| Phase | File | State injected | Options |
|
||||
| --- | --- | --- | --- |
|
||||
| `interrupt:choice` | `scheduler.py:279` | request text + `[current process: <skill>]` | `interrupt` / `defer` |
|
||||
| `priority:score` | `scheduler.py:296` | request text (+ `[current process: …]` when busy) | critical / high / medium / low |
|
||||
| `navigate:category` | `skills.py:682` | request text | every category name (+ `create_category`) |
|
||||
| `navigate:leaf` | `skills.py:736` | request text + current category | every skill name + description (+ `create_skill`) |
|
||||
| `navigate:response` | `skills.py:634` | request text + category | canned reply names + descriptions (catchall last) |
|
||||
@@ -362,8 +358,8 @@ fine-tuning loop — it is not yet the fine-tune itself.
|
||||
semif_agent/
|
||||
cli.py argparse: run / dream / skills / status / relabel /
|
||||
dashboard / gateway / bridge
|
||||
scheduler.py no up-front gate; choice -> score -> queue -> dispatch;
|
||||
preempt + requeue; needs_input pauses; async single-slot
|
||||
scheduler.py no up-front gate; FIFO queue -> dispatch;
|
||||
needs_input pauses; async single-slot
|
||||
skill authoring worker; fidelity gate; repair loop
|
||||
skill.py observe -> act -> observe -> assess; deterministic
|
||||
summary; pre-act contract collection; resolved-input state
|
||||
@@ -371,14 +367,17 @@ semif_agent/
|
||||
create gates, intent guard, tiered config resolution
|
||||
codegen.py OpenAI-compatible client; body/elicitation/test generation;
|
||||
parse/validate; CONTRACT + INTEGRATION extraction; test runner
|
||||
provider.py shared OpenAI-compatible transport (SSE/budget/idle/watchdog)
|
||||
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import)
|
||||
llm.py small OpenAI-compatible provider; authors new title + description
|
||||
provider.py shared OpenAI-compatible transport (SSE/budget/idle/watchdog);
|
||||
SemIfEngineClient generates text from the in-process engine
|
||||
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import);
|
||||
call() scores, generate() samples text
|
||||
llm.py small provider; authors new title + description
|
||||
(ollama / opencode / the loaded engine via `semif`)
|
||||
log.py decisions.jsonl rows {state, question, options, probs, ...}
|
||||
trace.py runs.jsonl lifecycle events keyed by run_id
|
||||
dream.py NLL / weighted CE / accuracy / ECE cost report
|
||||
decisions.py DecisionRequest / Option / DecisionResult / Request dataclasses
|
||||
queue.py urgency max-heap (weight desc, FIFO, ageing)
|
||||
queue.py bounded FIFO request queue
|
||||
dashboard.py stdlib HTTP + JSON API + static UI
|
||||
static/ dashboard frontend (html/js/css)
|
||||
simplex_ws.py neutral SimpleX daemon protocol (shared by gateway + bridge)
|
||||
@@ -418,10 +417,15 @@ machines:
|
||||
newly created category/skill. Deliberately its own endpoint/model, so it can
|
||||
stay local even when `codegen` is remote; it uses the same provider transport
|
||||
(`provider.py`) and an unreachable endpoint is graceful (the request is not
|
||||
re-dispatched), never fatal.
|
||||
re-dispatched), never fatal. Its `provider` can be `"ollama"` (default),
|
||||
`"opencode"` (the hosted Console API), or `"semif"` — the already-loaded
|
||||
decision engine model generates in-process, with no endpoint and no
|
||||
`llm.model` at all (see the `llm.semif` block in `config.json`).
|
||||
|
||||
The **decision engine is separate** and runs via llama.cpp CPU (or Vulkan if your
|
||||
build enables it), not ollama.
|
||||
The **decision engine is separate** and runs via llama.cpp, not ollama. It is CPU
|
||||
by default; to offload it to a GPU, set `engine.gpu_layers` in `config.json` and
|
||||
run `scripts/bootstrap.sh --gpu vulkan|rocm|cuda` (a GPU build is opt-in because
|
||||
it is slower on CPU).
|
||||
|
||||
### Option A: one-command provisioning (`bootstrap.sh`)
|
||||
|
||||
@@ -504,7 +508,7 @@ Key blocks:
|
||||
| `codegen` | skill-body model endpoint, timeouts, sampler, elicitation, fidelity, repair, test, degeneration watchdog, token budget |
|
||||
| `navigation` | two-stage guards: leaf `intent_tau`, category `category_tau` |
|
||||
| `tau` | decision threshold; `max_reentries` requeue bound |
|
||||
| `queue` | `max_size`, `age_rate` |
|
||||
| `queue` | `max_size` |
|
||||
| `skill_bodies` / `skill_seeds` / `log` / `trace` / `category_registry` | runtime paths (anchored to the checkout) |
|
||||
| `gateway.simplex` | command gateway: ws_url, allowlist, batching |
|
||||
| `gateway.voice` | voice gateway: wake/STT/TTS engines + models, audio devices, VAD, follow-up window |
|
||||
@@ -556,7 +560,7 @@ HF_HOME="$REPO/.runtime/hf" "$REPO/.runtime/venv/bin/python" -m semif_agent.cli
|
||||
Type a request, or one of the meta-commands:
|
||||
|
||||
```
|
||||
busy <text> mark a current process (so preemption can be demonstrated)
|
||||
busy <text> mark a current process (so the queue can be demonstrated)
|
||||
idle clear the current process
|
||||
status current process + queue
|
||||
skills skill tree
|
||||
@@ -599,7 +603,7 @@ shares one scheduler/skill store. `--platform` takes a comma-separated list or
|
||||
python -m semif_agent.cli gateway [--platform simplex,lxmf,voice|all] [--dashboard]
|
||||
```
|
||||
|
||||
Each platform feeds authorized DM text through the normal gate/score/queue/
|
||||
Each platform feeds authorized DM text through the normal queue/dispatch
|
||||
dispatch pipeline. Results, authoring questions and repair offers go back to the
|
||||
originating chat. Config lives under `gateway.<platform>` in `config.json`;
|
||||
`enabled` defaults to false. Both transports are **default-deny** — put allowed
|
||||
@@ -638,7 +642,7 @@ address as a contact in your LXMF client and DM it.
|
||||
`gateway --platform voice` turns the machine's microphone into a command front
|
||||
end: an always-on **wake word** (openWakeWord), **speech-to-text**
|
||||
(faster-whisper), and **text-to-speech** (Piper), all local — no cloud. A spoken
|
||||
command is fed through the same gate/score/queue/dispatch pipeline as a typed or
|
||||
command is fed through the same queue/dispatch pipeline as a typed or
|
||||
messaged one, and every reply is spoken back. It is a normal gateway adapter, so
|
||||
`needs_input` questions, repair offers, and approvals are spoken and answered by
|
||||
voice too.
|
||||
@@ -668,7 +672,7 @@ python -m semif_agent.cli gateway --platform voice
|
||||
utterance is accepted **without** the wake word for `follow_up_window_s`, so
|
||||
answering a question is conversational. `max_speak_chars` truncates long
|
||||
replies before speaking. `result_only` (default true for voice) speaks only the
|
||||
skill's result line — queue/urgency bookkeeping is dropped and the
|
||||
skill's result line — scheduler bookkeeping is dropped and the
|
||||
`<skill>: ok —` wrapper is stripped — so the spoken output is the answer, not
|
||||
the scheduler's internals; set it false to speak the full scheduler output.
|
||||
There is no allowlist: the mic is local, so physical access is the
|
||||
@@ -804,7 +808,7 @@ works.
|
||||
|
||||
## Roadmap / status
|
||||
|
||||
**Done.** Core loop, urgency queue, skill tree, real SemIf assessment, decision
|
||||
**Done.** Core loop, FIFO queue, skill tree, real SemIf assessment, decision
|
||||
logging, `dream` cost pass, REPL + JSONL CLI; live `create_category` /
|
||||
`create_skill` with the async authoring pipeline (elicitation → body → fidelity →
|
||||
contract → test → auto-run → re-dispatch); tiered config + first-fire
|
||||
|
||||
+26
-8
@@ -1,23 +1,29 @@
|
||||
{
|
||||
"_comment": "Per-machine config. config.json is gitignored. bootstrap.sh seeds config.json from this file only when config.json does not exist, and NOTHING writes config.json afterwards — only a human edits it. Pinned engine/tokenizer/GGUF/simplex-chat refs live in the committed pins.json, not here. Every machine keeps its own config.json.",
|
||||
"_comment": "Per-machine config. config.json is gitignored. bootstrap.sh seeds config.json from this file only when config.json does not exist, and NOTHING writes config.json afterwards — only a human edits it. Pinned engine/tokenizer/GGUF/simplex-chat refs live in the committed pins.json, not here. Every machine keeps its own config.json. Top-level `timezone` is the IANA zone (e.g. America/Chicago) the agent reports local time in; empty means the host's local timezone.",
|
||||
"tau": 0.6,
|
||||
"max_reentries": 3,
|
||||
"creation_approval": false,
|
||||
"timezone": "",
|
||||
"navigation": {
|
||||
"_comment": "Navigation is two-stage at BOTH levels and the guards are the create doors (no threshold gate). Category: the softmax offers each existing category WITH its description (bare names carried no signal) plus create_category; confirm_category_fit then confirms the winner's scope (phase navigate:category_scope, P(covers) >= category_tau) and a rejected winner authors a new category. The `response` catchall and create_category share a boundary arbitrated by the actionability guard confirm_non_action (phase navigate:actionability, P(non_action) >= action_tau): the closed response tree is reached ONLY when the input is not a request, so a request no skill covers (e.g. \"what is 255 * 12?\") authors instead of getting a canned reply. Leaf: the softmax offers only existing skills; confirm_skill_fit then compares the winner's action to the request (phase navigate:intent, P(same) >= intent_tau) and a mismatch authors a new leaf. All three taus are separate from the top-level tau so tuning reuse-vs-create or actionability does not move run assessment/fidelity. The category check is deliberately permissive: with real descriptions in-scope requests score 0.9-1.0, so a borderline over-cover routes into a plausible category and the leaf guard catches it.",
|
||||
"_comment": "Navigation is two-stage at BOTH levels and the guards are the create doors (no threshold gate). Category: the softmax offers each existing category WITH its description (bare names carried no signal) plus create_category; confirm_category_fit then confirms the winner's scope (phase navigate:category_scope, P(covers) >= category_tau) and a rejected winner authors a new category. The `response` catchall and create_category share a boundary arbitrated by the actionability guard confirm_non_action (phase navigate:actionability, P(non_action) >= action_tau): the closed response tree is reached ONLY when the input is not a request, so a request no skill covers (e.g. \"what is 255 * 12?\") authors instead of getting a canned reply. Leaf: the softmax offers only existing skills; confirm_skill_fit then compares the winner's action to the request (phase navigate:intent, P(same) >= intent_tau) and a mismatch authors a new leaf. All three taus are separate from the top-level tau so tuning reuse-vs-create or actionability does not move run assessment/fidelity. The category check is deliberately permissive: with real descriptions in-scope requests score 0.9-1.0, so a borderline over-cover routes into a plausible category and the leaf guard catches it. A softmax winner at or above `softmax_bypass_tau` (default 0.5) skips its confirm guard — the winner is already decisive and each skipped guard is one fewer SemIf call on the hot path (traced `category_scope_bypassed` / `intent_bypass`); below it the two-stage confirm runs unchanged.",
|
||||
"intent_tau": 0.6,
|
||||
"category_tau": 0.75,
|
||||
"action_tau": 0.5
|
||||
"action_tau": 0.5,
|
||||
"softmax_bypass_tau": 0.5
|
||||
},
|
||||
"queue": {"max_size": 100, "age_rate": 0.01},
|
||||
"queue": {"max_size": 100},
|
||||
"engine": {
|
||||
"_comment": "Per-machine engine settings only. The pinned engine/tokenizer/GGUF refs (semif_repo, semif_ref, gguf_url, gguf_sha256, source, revision) live in the committed pins.json — bumped on update, never per-machine config. The GGUF path is derived from pins.json's engine.gguf_url under .runtime/models/; set `gguf` here only to override it with a custom path.",
|
||||
"_gpu_comment": "gpu_layers: 0 keeps the CPU-only default, -1 offloads every layer, a positive count offloads that many. Requires a llama-cpp-python built with a GPU backend (bootstrap detects Vulkan/ROCm/CUDA). gpu_device picks the llama.cpp device index and gpu_split sets its split mode (0 = none).",
|
||||
"backend": "llamacpp",
|
||||
"context_tokens": 4096,
|
||||
"threads": 8
|
||||
"threads": 8,
|
||||
"gpu_layers": 0,
|
||||
"gpu_device": null,
|
||||
"gpu_split": 0
|
||||
},
|
||||
"llm": {
|
||||
"_comment": "Small OpenAI-compatible model that authors a new category/skill title + description (never the runnable body — that is `codegen` below). Deliberately its own endpoint/model, so it can be local and fast even when codegen is remote. Runs on THIS machine's local ollama; bootstrap reads base_url/model from here (a --llm-url/--llm-model flag overrides for that run only) and pulls `model` if it is missing. `model` is required (no default): set it to a model the endpoint serves. Uses the same provider machinery as codegen (real SSE stream, token budget, idle watchdog); short JSON replies. Sampler params (temperature/top_p/presence_penalty/frequency_penalty) are opt-in: an unset value is omitted from the request so the server's model default applies — set them here only when you know the right values for the model. The draft is authored asynchronously by a single-slot worker and the request re-runs when it lands; an unreachable endpoint is graceful (traced, user notified), not fatal. disable_thinking sends reasoning_effort:none so a reasoning model answers the short JSON directly instead of spending the reply budget on hidden chain-of-thought (set false only for an endpoint that rejects the parameter). provider selects the transport: \"ollama\" (default; a local OpenAI-compatible server, context auto-detected via /api/show) or \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code or glm-5.3, and provide api_key or api_key_env; the ollama probe is skipped).",
|
||||
"_comment": "Small OpenAI-compatible model that authors a new category/skill title + description (never the runnable body — that is `codegen` below). Deliberately its own endpoint/model, so it can be local and fast even when codegen is remote. Runs on THIS machine's local ollama; bootstrap reads base_url/model from here (a --llm-url/--llm-model flag overrides for that run only) and pulls `model` if it is missing. `model` is required (no default): set it to a model the endpoint serves. Uses the same provider machinery as codegen (real SSE stream, token budget, idle watchdog); short JSON replies. Sampler params (temperature/top_p/presence_penalty/frequency_penalty) are opt-in: an unset value is omitted from the request so the server's model default applies — set them here only when you know the right values for the model. The draft is authored asynchronously by a single-slot worker and the request re-runs when it lands; an unreachable endpoint is graceful (traced, user notified), not fatal. disable_thinking sends reasoning_effort:none so a reasoning model answers the short JSON directly instead of spending the reply budget on hidden chain-of-thought (set false only for an endpoint that rejects the parameter). provider selects the transport: \"ollama\" (default; a local OpenAI-compatible server, context auto-detected via /api/show), \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code or glm-5.3, and provide api_key or api_key_env; the ollama probe is skipped), or \"semif\" (the loaded SemIf decision GGUF generates in-process via SemIfEngine.generate — no endpoint/model/api_key is used; see the `semif` block below).",
|
||||
"provider": "ollama",
|
||||
"base_url": "http://localhost:11434/v1",
|
||||
"model": "",
|
||||
@@ -33,7 +39,12 @@
|
||||
"top_p": 0.9,
|
||||
"presence_penalty": 0.0,
|
||||
"frequency_penalty": 0.0,
|
||||
"disable_thinking": true
|
||||
"disable_thinking": true,
|
||||
"semif": {
|
||||
"_comment": "Settings for provider == \"semif\": the already-loaded SemIf engine model generates the text in-process (the same GGUF the decision engine scored with), so no base_url/model/api_key is used and `model` above is not required. temperature 0 = greedy decoding; max_tokens bounds the reply length (callers may override per call). Generation shares the engine's lock with decision scoring, so a reply briefly serializes against routing/assessment.",
|
||||
"temperature": 0.0,
|
||||
"max_tokens": 256
|
||||
}
|
||||
},
|
||||
"codegen": {
|
||||
"_comment": "OpenAI-compatible model that writes runnable skill bodies. Runs on a REMOTE ollama host (bootstrap reads base_url/model from here; a --codegen-url/--codegen-model flag overrides for that run only); the local small model is `llm` above. `model` is required (no default): set it to a code-capable model the endpoint serves. Bodies perform real actions against the user's configured services via stdlib transports, read every operational value from ctx.config, and declare their integration (INTEGRATION: service/transport/config_vars). Larger/slower than the decision or title/description model. The transport always streams so the client-side token budget (output cap / peak total fill) can abort a runaway in real time; stream only toggles console echo of tokens. timeout is total seconds; idle_warn/idle_timeout surface a silent (wedged) stream. The context window is auto-detected via ollama /api/show; context_window is the manual fallback (0 = auto/default 100000). smart_limit/warn_limit and max_fill_ratio/warn_fill_ratio bound total fill; max_output caps streamed output (>=1 absolute tokens, 0<x<1 fraction of window); chars_per_token converts chars to the token estimate. temperature/top_p/presence_penalty/frequency_penalty are opt-in: an unset value is omitted from the request so the server's model/Modelfile default applies; set them here only when you know the right values for the model. A rejected body retries with a fresh short prompt (max_attempts attempts), reusing the same sampler params. elicitation asks the product owner implementation questions before the body is written (posted to the question queue; every front end defers). After the body lands it is reviewed for real-action fidelity, then the data contract (contract.json) is derived in a separate call, then skill.test.py (hermetic mechanics test: loopback http.server for HTTP bodies, fixtures inline, no external network) in a shared-context call, and the test is auto-run as a subprocess (test_timeout seconds); on failure a 3-option SemIf decision (code/contract/test) regenerates the failing piece, bounded by test_max_attempts. contract_search.enabled auto-populates the skill config.json via SemIf against the global + category config. provider selects the transport: \"ollama\" (default; local OpenAI-compatible server, context auto-detected via /api/show) or \"opencode\" (the hosted OpenCode Console inference API at https://opencode.ai/inference/openai/v1 — set model to a Chat Completions family id such as kimi-k2.7-code, glm-5.3, or deepseek-v4.1-flash, and provide api_key or api_key_env; the ollama probe is skipped).",
|
||||
@@ -131,6 +142,13 @@
|
||||
},
|
||||
"gateway": {
|
||||
"_comment": "Messenger COMMAND intake — and nothing else. `python -m semif_agent.cli gateway` runs one or more platforms (`--platform simplex,lxmf` or `all`) in a SINGLE process sharing one scheduler/skill store — never run two gateway processes over one store. Each platform feeds authorized DM text through the normal gate/score/queue/dispatch pipeline; results, authoring questions, and repair offers are sent back to the originating chat. It must never read a contact's history, show/create invite links, or compose on the user's behalf — that is the independent bridge services' job (`bridges`). home_channel receives messages whose origin chat is unknown (e.g. a background repair offer). reply_prefix is prepended to every reply. text_batch_delay concatenates rapid-fire messages from one contact.",
|
||||
"humanize": {
|
||||
"_comment": "Optional LLM cleanup of a skill's result line for chat replies. Off by default. When enabled, a completed result is unwrapped from the scheduler's `<skill>: <ok|failed> — <detail>` bookkeeping and rewritten by the scheduler's `llm` client into one grounded, friendly sentence; it never decides success/failure and always falls back to the raw result on any error. `timeout`/`max_tokens`/`max_chars` bound the auxiliary call (a slow cleanup must not hold the gateway). A platform turns it on/off with its own `humanize` key (bool or `{enabled: ...}`), overriding this global default; `timeout`/`max_tokens`/`max_chars` are global. Only result lines are cleaned — questions, repair/approval notices, and status chatter are untouched.",
|
||||
"enabled": false,
|
||||
"timeout": 20.0,
|
||||
"max_tokens": 200,
|
||||
"max_chars": 600
|
||||
},
|
||||
"simplex": {
|
||||
"_comment": "SimpleX command adapter. Connects to the command simplex-chat daemon (`simplex_chat.port`) over its JSON WebSocket API. Requires the optional `websockets` package (lazy-imported; the gateway refuses to start without it). allowed_users entries match either a numeric contactId or a display name; default is deny-all unless allow_all_users is set. Groups/attachments are not supported.",
|
||||
"enabled": true,
|
||||
@@ -207,7 +225,7 @@
|
||||
"dc_removal": true
|
||||
},
|
||||
"vad": {
|
||||
"silence_ms": 1000,
|
||||
"silence_ms": 500,
|
||||
"min_speech_ms": 120,
|
||||
"max_utterance_s": 30,
|
||||
"aggressiveness": 2,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 687.344px; background-color: white;" viewBox="4 4 687.34375 3827.421875" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-coLine truncated
|
||||
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 746.35px; background-color: white;" viewBox="4 4 746.3495483398438 4081.421875" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][Line truncated
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
@@ -96,4 +96,4 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAAfcABMAAAAAENQAAAdzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGx4cKD9NVkFSgQQGYD9TVEFUgWInLgBUL3QRCAqDIIMLCw4AMIV2ATYCJAMUBCAFjXYHTgwHG2MPSI7UVnlAcpP/PG76574XKIQgNQ9aMWYOzJzOnNE6+ESr23eT2sQ1RNFtdi+PQgg0oMcgECuU/O/3a6IXUT+YhE5qlMRjzRMmUcT/YlIScRND3N9WFIkkvBEqHjKN0AqmS7W7pslGyKGniKzRX/+9JQiAiBw5aNSYSTOggQAAigIAiiIHB/beSc/SWAAGANDyAhpoMeP2RQKKNKUDo1nRZauCIaHysUgQAKNoAY8HlgeJKDoirKqpjmHl8iNBgurKDAAZMvKGFua5re5aEBjg+Fyna7lAoPNUChXAbmNzAEzcG6ZFKEsOpL8J4Egh/wvuyzsb30Avf8A/UtSA8DEZl4DuBwBmYF8AkEkgMGigApBCB2AoNnnqlKmkB0aelZPIAFpZXRMjI1i0IRAjE/hIb+UsSoSA+7AJawQs4jXGYOUs0hAYQE/ww0A+7XHelvYYl9MeZV+kPcLmJDxM54kbZvQQ3QNokx6kUqL2BwAmBN0nF/y6ngQfzpwmgFq038AQjGjtpvSk8anfZwfIhO0+c2bZx44f+m8b8LALJOxE4gMpOCj9GwJcAAkaMAjQQ/aMnCB/oCiA5W3KZWWPsmzX9V3TQBBrBMCEgZBCA7FL20qBd3NHDYKM5LVlUCXNK38PQPNp2cLzAPm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4ktojFkWe/HAb4988Y+h95QVHtzOplIbRo/um6M+e2jP1u79567yg5zc9s9ff3zbChAASv0+8GHvzYuNQy9oOD8MADv3Pa9NX3cgoKjZHN4XgBoMAEDAt6ufzQEepxD2MsEpXEvlUCaVQaEadYT1/G5GIAAF2QoOErQAHhNa8iD03yaBwSAMB8esOQwBY+Y5qJA1txSr4Zpx1UiPpOkPAyReTMaQPJgg8hQkwsDV8MLS/ahEaT/BPKT1OcyHsxEsg61T4ENhHahDYW6iHr3zByKQ8waiKE4LrQmZg7XoGxtaYAlDK0p10W0hr+F2FGvCfdBgFR6AhAY8CBHLZA91r5DxMCTMwiMwGYNHocFwPIYkpXgcIix4AikMf+VJGADMFBJRq1qNmNFWiYlYyqPBUj71p7WKkaAGyx8zK/k1qrXRZFo+EtdoUgUs1xPgxwkRlfwBUV5+PnGR50itFfzOhZMERJSZE4S6/rFTRu0ph80VLNRv8qk/4Pqdwy1gsZrjgxNWXzDhUHGDrtVyh9PkTSJXTwmOOKaKUC1vAGyM5QoST71NBbZatdtImLzhfDZmNr/uaktFxS3VYLKggKCo0DRpuF9c7arT+g3tnMXvz+AfJeulnNNA/eigcqN2katYjfxJh3Dz8pptSODrWvQf7MUjBYWsFgmfrzenXgaRzbCSf0P8xGkiguqczHOhW1xMjaByoqxQtVqrhbhlyvkENaoQBPN+/5ViVgvxqxCpor8IgzSq9EGZy6kBcGLESSBVQjxQ63S6nWn2E8on0tNX4uR5oz4hpf0d4U4AAAA=") format("woff2-variations"); unicode-range: U+460-52F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAC98ABQAAAAAckwAAC8MAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGnUbh2wcKD9NVkFSgQQGYD9TVEFUgWInLgCDAC90EQgKxVy+FwuCHAAw6w4BNgIkA4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PRXS+XGnsCt0toBY0pobbcyPojDYpPVKnZfHAs5qkVUuWxfmOgPMP7wnXmOYEiayZ/kcOazDjFS3ipN5PxF+374on7BAiqY3M8VcM9Kcwewc2cmVPOGSFZMiLUz4tut7X0987t11/t+GJ9VhOzLxIukkhUYhSTF2KGdlcM6I+a2kvnpO19PzQL4FOHW4y7DLnAxmT58HBJJWBMlQ+9TzLF5U1BVy64ynGgO7beUt4ccjb5Vrm2dkfXwcWL8YgND862ORaXdAY0f07X3NugvWrLSae1Tq0wBvoH/OYaE63sL9mlbu9UncZlEGf1s8CG99x5Z7eIZUHFEpe7itoqbyi7KrK/8WhLzE5pBA4jOkUOidKhtD513zrLYHB79OLYpUIKpyjqIfGoMxFaE9ngW2TK5vQLine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAMcoABQAAAACIVgAAMazAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoFpG6NkHIJ6P01WQVKBBAZgP1NUQVSBYicuAIhQL3QRCAqC7HSCwVgLhiAAMITeAAE2AiQDjDwEIAWNdgedLwwHW0AHckHF6x6C2wbAvHMdZvVXhTJuj3CeYJV5mv/DZkbzOAi4NJL9/39SciJjbCrwqe83ywIzgolkyo3VCjtasCkUIVMwDzfKONHViNbg12b3EYqYi2Z2gbgyLnivrnQwI5gRjORbUCxIgbEUGuMtOH4+0kIxJ7MeGRm5znGzgd0Ehd1goLq/PT4lfx06eOqGGV+EerXkB9un0+PUHbj/0wfMuZi5FhCvOSbuyzWr4djgX8HBHp3zvlAbHhhZpQ+Zd4ZnjStdBcYumxGr6sQL/8/3V/7a5zwU0e3qqOrLfklGH5KmgEbBHaK1NbN5kdxxHAecR6QHHrR4sAiCpCIHiBiJmIBwkiUi0fYbGA02COor2tiNDVbgcTvwndlPtIkHcjDJRNjNquDBvXuQe/OIX4JHtT1VW6zDP/8/9rR93htHpZJMumid8Yy45Aohm1ZCZ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UET/zBIM3Drzn1uew+Ur+82tsDmNq149+hgp6ekegV1oR8L4XFMkl1qaEXs5JZQt2kEMfKpXq/Uqq1ZIE+HAjxpZfA85NWR5aeb53cAw2wOqEpU3KyLKsC79hAUyBQRGicAL3moCqnXQ7PL/9OH4DRSUuyJqkjrrywijYn+JJkI+yo5mES/3DjYuZ+sK3Fjv0PnnOwaBx3zsINdABi5MeqHv9mM0wJwSHTUy50eFSB6t2xJ17+0KtKJviVMJkevf7g3FVlsyqw72TkWB7DZubz25Jgp+9NuAk584fs9r3NONeF/3Klm4khYA0RPij8DvPRuzCpItwTBqSUY2x9jCxvA6pAtThekPi4A6z2qCX08AI98qdvr4wPk0Nd3en0C0PXOaUafEIwG5bIlmSZKEG9OLEhAEICu83eAsNe1XrrXNa7Y62rr3usqi2u/Uj+IH4yoRXWlObtdLiWBmcvUtKRfIqL8/vWgG59lcBvezHyJCgOO/Mwaiaxe7TFJSrxTDeaD/o9sKh6PPFdqTTEcFkDLOrhmYpH635szFCIg4KKwMZUmlF+tGrRem9SuXr3VR3031hzN1Txt0kpdx6zbTtp5u2xPHKIYykQt3X4iK6/KuwIvyIIuuEJFaAk9YTWgCUwOzA8kB3ICZXKFXC3Xy63y95+HKnrSZxSIAlcEFFFFQpFW5BR5894ZDRLOBHBZRaPDztp0Rm/0QV+1aY6pAHfCJ+AL8wDqKOPxychL8pbACZKgCY5QFppCV5gPhAfiA9MCiwKZgUK5XK66m/YGjOaPKOIKQpFtq9nzIvyE/a0PZPhgoQDQwsib87fnob5YX6Tfps/S1+oDP3f5GL3qz9cAiPjNmy/0AHz5/+7bnnc+TzyPM07kefh58Hnguf/5GIBA7iTPk/PTqfYrqZQKVaxSVeiSrnPXRc+oW6d14clkenVV13VTt3VXffqmC5ZDBCYxhVmsN8x6OPwtQ6IEG5BsxGErLtvw2I7PjpeX/xlcmy2G2kiLine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;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8NGDREh5krkFcIFilrNmzZsedAzhvdc3a3TAprp7fObeDqdrvdblT3f3bbufl+E4BoTAS81czMRESkxMTMzMzMfGNzkCr4IPhwwgxc3FsEAJiZKzMYAAAAeBamvWW367vZplUq9gSVmSSp72dTbxER4SofXDI07b0w+uLW3GOci7O4ePgEhCu4/xu3SVBnco+soMDgCCQKjcHiGv7ITwECkUSmUGl0RoYzq9jC5nB5fIFwiKZuiyPx+hEjRWkU1V+dTy4XVw1uHx8w+WF4PbzDpwnfxA8d/giIQAQJFiI0wi6H8FtEiGyiSrQYo40ZxrbY4RB3iUeCREmSY3w7THhMVEySyU3KLVWadBkyI0uyI0dyh7xT/nUUmEJFikPd/LXkUhplR5RLRVMZUyarHtW3msNazbpx1CsaGo1/brpiKU7n4xWgIP4o+U4ePZjydRr25K9KhImUIlWadBkyZatWc19jdz8U3lqP/XJRt6uuuemeB+NCsREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+DocGCzf//OUmHDA24BYDSav30gpTm5oLukVWFEcnonETmsMyRwaxVlcU6uxC9iCZsnT5P+qBoOkFJiqiJxWuPNWT7PHCRw81p1qChF3rCbO9Tu7fKOEyVB/700RQcsJ+gQiqTRi2ocJv6bJMhDPbujiO3awaKVPgtloNHC3ypGDWXlJT8TCcDP38oPBpOaRPPvYUR27Ml25a6QKxwENkIP/a69v/FRGp+aQ7XI8XziaUuA2OXQYk21onIvMPT3P69d7HtlowxR4Zz4BwVR6VBW2SMlChRw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sREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated
|
||||
|
Before Width: | Height: | Size: 322 KiB After Width: | Height: | Size: 367 KiB |
+2
-2
@@ -1,4 +1,4 @@
|
||||
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 1408.24px; background-color: white;" viewBox="4 4 1408.2369384765625 5994.984375" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"Line truncated
|
||||
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 1487.92px; background-color: white;" viewBox="4 4 1487.923095703125 7298.546875" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;fill:#28253D;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#my-svg .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#my-svg .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#my-svg .error-icon{fill:#ffffff;}#my-svg .error-text{fill:#000000;stroke:#000000;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-thickness-invisible{stroke-width:0;fill:none;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#000000;stroke:#000000;}#my-svg .marker.cross{stroke:#000000;}#my-svg svg{font-family:"Recursive Variable",arial,sans-serif;font-size:14px;}#my-svg p{margin:0;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) rect{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].cluster:not(.swimlane) path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster rect.swimlane-body{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-0"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-group path{stroke:#E879F9;fill:#FDF4FF;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-indicator{fill:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-0"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-0"].rough-node .collapsed-separator{stroke:#E879F9;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) rect{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].cluster:not(.swimlane) path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster rect.swimlane-body{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:nth-of-type(2){stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-title path:first-of-type,#my-svg [data-look="neo"][data-color-id="color-1"].swimlane.cluster .swimlane-body path:first-of-type{stroke:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group,#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-group path,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-group path{stroke:#2DD4BF;fill:#F0FDFA;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-indicator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-indicator{fill:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-1"].node .collapsed-separator,#my-svg [data-look="neo"][data-color-id="color-1"].rough-node .collapsed-separator{stroke:#2DD4BF;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) rect{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].cluster:not(.swimlane) path{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-title,#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster rect.swimlane-body{stroke:#FB923C;fill:#FFF7ED;}#my-svg [data-look="neo"][data-color-id="color-2"].swimlane.cluster .swimlane-title path:nth-of-type(2),#my-svg [data-look="neo"]Line truncated
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
@@ -96,4 +96,4 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAAfcABMAAAAAENQAAAdzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGx4cKD9NVkFSgQQGYD9TVEFUgWInLgBUL3QRCAqDIIMLCw4AMIV2ATYCJAMUBCAFjXYHTgwHG2MPSI7UVnlAcpP/PG76574XKIQgNQ9aMWYOzJzOnNE6+ESr23eT2sQ1RNFtdi+PQgg0oMcgECuU/O/3a6IXUT+YhE5qlMRjzRMmUcT/YlIScRND3N9WFIkkvBEqHjKN0AqmS7W7pslGyKGniKzRX/+9JQiAiBw5aNSYSTOggQAAigIAiiIHB/beSc/SWAAGANDyAhpoMeP2RQKKNKUDo1nRZauCIaHysUgQAKNoAY8HlgeJKDoirKqpjmHl8iNBgurKDAAZMvKGFua5re5aEBjg+Fyna7lAoPNUChXAbmNzAEzcG6ZFKEsOpL8J4Egh/wvuyzsb30Avf8A/UtSA8DEZl4DuBwBmYF8AkEkgMGigApBCB2AoNnnqlKmkB0aelZPIAFpZXRMjI1i0IRAjE/hIb+UsSoSA+7AJawQs4jXGYOUs0hAYQE/ww0A+7XHelvYYl9MeZV+kPcLmJDxM54kbZvQQ3QNokx6kUqL2BwAmBN0nF/y6ngQfzpwmgFq038AQjGjtpvSk8anfZwfIhO0+c2bZx44f+m8b8LALJOxE4gMpOCj9GwJcAAkaMAjQQ/aMnCB/oC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Ak82BreUW2M/VMV2Hn6ZQKe45Dd+gPS4dE++Ak98DUA7++datHibOpvDueffbNH3dTSmZOdrKo4ktojFkWe/HAb4988Y+h95QVHtzOplIbRo/um6M+e2jP1u79567yg5zc9s9ff3zbChAASv0+8GHvzYuNQy9oOD8MADv3Pa9NX3cgoKjZHN4XgBoMAEDAt6ufzQEepxD2MsEpXEvlUCaVQaEadYT1/G5GIAAF2QoOErQAHhNa8iD03yaBwSAMB8esOQwBY+Y5qJA1txSr4Zpx1UiPpOkPAyReTMaQPJgg8hQkwsDV8MLS/ahEaT/BPKT1OcyHsxEsg61T4ENhHahDYW6iHr3zByKQ8waiKE4LrQmZg7XoGxtaYAlDK0p10W0hr+F2FGvCfdBgFR6AhAY8CBHLZA91r5DxMCTMwiMwGYNHocFwPIYkpXgcIix4AikMf+VJGADMFBJRq1qNmNFWiYlYyqPBUj71p7WKkaAGyx8zK/k1qrXRZFo+EtdoUgUs1xPgxwkRlfwBUV5+PnGR50itFfzOhZMERJSZE4S6/rFTRu0ph80VLNRv8qk/4Pqdwy1gsZrjgxNWXzDhUHGDrtVyh9PkTSJXTwmOOKaKUC1vAGyM5QoST71NBbZatdtImLzhfDZmNr/uaktFxS3VYLKggKCo0DRpuF9c7arT+g3tnMXvz+AfJeulnNNA/eigcqN2katYjfxJh3Dz8pptSODrWvQf7MUjBYWsFgmfrzenXgaRzbCSf0P8xGkiguqczHOhW1xMjaByoqxQtVqrhbhlyvkENaoQBPN+/5ViVgvxqxCpor8IgzSq9EGZy6kBcGLESSBVQjxQ63S6nWn2E8on0tNX4uR5oz4hpf0d4U4AAAA=") format("woff2-variations"); unicode-range: U+460-52F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAC98ABQAAAAAckwAAC8MAAEAAAAAAAAAAAAAAAAAAAAAAAAAA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yA6n/ZSgFZazJNAerh/S15bZZafh+oSmZSpqUPfO7eQlKoBJKTpFdBIFjvOfm7/XOHidnMXPRXS+XGnsCt0toBY0pobbcyPojDYpPVKnZfHAs5qkVUuWxfmOgPMP7wnXmOYEiayZ/kcOazDjFS3ipN5PxF+374on7BAiqY3M8VcM9Kcwewc2cmVPOGSFZMiLUz4tut7X0987t11/t+GJ9VhOzLxIukkhUYhSTF2KGdlcM6I+a2kvnpO19PzQL4FOHW4y7DLnAxmT58HBJJWBMlQ+9TzLF5U1BVy64ynGgO7beUt4ccjb5Vrm2dkfXwcWL8YgND862ORaXdAY0f07X3NugvWrLSae1Tq0wBvoH/OYaE63sL9mlbu9UncZlEGf1s8CG99x5Z7eIZUHFEpe7itoqbyi7KrK/8WhLzE5pBA4jOkUOidKhtD513zrLYHB79OLYpUIKpyjqIfGoMxFaE9ngW2TK5vQLine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAAMcoABQAAAACIVgAAMazAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoFpG6NkHIJ6P01WQVKBBAZgP1NUQVSBYicuAIhQL3QRCAqC7HSCwVgLhiAAMITeAAE2AiQDjDwEIAWNdgedLwwHW0AHckHF6x6C2wbAvHMdZvVXhTJuj3CeYJV5mv/DZkbzOAi4NJL9/39SciJjbCrwqe83ywIzgolkyo3VCjtasCkUIVMwDzfKONHViNbg12b3EYqYi2Z2gbgyLnivrnQwI5gRjORbUCxIgbEUGuMtOH4+0kIxJ7MeGRm5znGzgd0Ehd1goLq/PT4lfx06eOqGGV+EerXkB9un0+PUHbj/0wfMuZi5FhCvOSbuyzWr4djgX8HBHp3zvlAbHhhZpQ+Zd4ZnjStdBcYumxGr6sQL/8/3V/7a5zwU0e3qqOrLfklGH5KmgEbBHaK1NbN5kdxxHAecR6QHHrR4sAiCpCIHiBiJmIBwkiUi0fYbGA02COor2tiNDVbgcTvwnd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Line truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+DocGCzf//OUmHDA24BYDSav30gpTm5oLukVWFEcnonETmsMyRwaxVlcU6uxC9iCZsnT5P+qBoOkFJiqiJxWuPNWT7PHCRw81p1qChF3rCbO9Tu7fKOEyVB/700RQcsJ+gQiqTRi2ocJv6bJMhDPbujiO3awaKVPgtloNHC3ypGDWXlJT8TCcDP38oPBpOaRPPvYUR27Ml25a6QKxwENkIP/a69v/FRGp+aQ7XI8XziaUuA2OXQYk21onIvMPT3P69d7HtlowxR4Zz4BwVR6VBW2SMlChRwmzEbMxGP1b9j1EBH3DbDdCcdsQEon7JRfwSB2JOgISEoFrXAasoq9ikuqrMWEV/62jp5u1E+1v/V5m3nf1UU7+qXlFXNUotNMcB/IgeADjNAt72urO3lVp2YBGuBJyZT+j874Adx5a4m6t4+H87sPv+xERJd6LbnJR0C9XSut7hn/pD3nP3/VCsEWY8IKVyL0BRbPrJwpkALvSfe/ntnpvXkl+oTdlum8K2LiSDUyiDU4xHZ6hWWmURJHAkUCRwVVYWcFc1qyW2TDDkPQCUy/ISPQnRMEiSLBlE0Gqe0tm/u7JkGT8STP/bEDVVzrq7D1ilTqbPpASCR+Q7gyzJwiWc/zr//9vnfT/qQEpcRgoKK0nFOCd9V1qjXj3ukTmFPIN8B77N7El80zWp+LXb3t1TsS//NOl0e2JW0WxECQkSbGAYYRgxQQcLGfht9f844fRGn+hkZjZuva6/iAQxMBsTRBRsREHF6MneytsxPPxzr75PAd4cWpYTG2vx7vJiXWpQLuaqqxWIIP5+vZ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s3/vYywsGgv22B9x5IhjTJ5YOb12pjm7cc55F5qLj25XXXMz7gzjnuI+8SB5Fs8VL/BSv/8NGDREh5krkFcIFilrNmzZsedAzhvdc3a3TAprp7fObeDqdrvdblT3f3bbufl+E4BoTAS81czMRESkxMTMzMzMfGNzkCr4IPhwwgxc3FsEAJiZKzMYAAAAeBamvWW367vZplUq9gSVmSSp72dTbxER4SofXDI07b0w+uLW3GOci7O4ePgEhCu4/xu3SVBnco+soMDgCCQKjcHiGv7ITwECkUSmUGl0RoYzq9jC5nB5fIFwiKZuiyPx+hEjRWkU1V+dTy4XVw1uHx8w+WF4PbzDpwnfxA8d/giIQAQJFiI0wi6H8FtEiGyiSrQYo40ZxrbY4RB3iUeCREmSY3w7THhMVEySyU3KLVWadBkyI0uyI0dyh7xT/nUUmEJFikPd/LXkUhplR5RLRVMZUyarHtW3msNazbpx1CsaGo1/brpiKU7n4xWgIP4o+U4ePZjydRr25K9KhImUIlWadBkyZatWc19jdz8U3lqP/XJRt6uuuemeB+NCsREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated
|
||||
@font-face { font-family: "Recursive Variable"; font-style: normal; font-display: swap; font-weight: 300 1000; src: url("data:font/woff2;base64,d09GMgABAAAAANo0ABQAAAABw5wAANnAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoNJG+NQHJFiP01WQVKBBAZgP1NUQVSBYicuAIUuL3QRCAqClRSB7QQLhEwAMIPENgE2AiQDiRAEIAWNdgeLCAwHW+GrcUA2xSrj8Xqzqt7vcDOutoLdMgy1E/ncqmGr3EUHco+DocGCzf//OUmHDA24BYDSav30gpTm5oLukVWFEcnonETmsMyRwaxVlcU6uxC9iCZsnT5P+qBoOkFJiqiJxWuPNWT7PHCRw81p1qChF3rCbO9Tu7fKOEyVB/700RQcsJ+gQiqTRi2ocJv6bJMhDPbujiO3awaKVPgtloNHC3ypGDWXlJT8TCcDP38oPBpOaRPPvYUR27Ml25a6QKxwENkIP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piKU7n4xWgIP4o+U4ePZjydRr25K9KhImUIlWadBkyZatWc19jdz8U3lqP/XJRt6uuuemeB+NCsREhMo+TRkREWmRP5q5Zo0bjOKtKFH8M7IQBlH8Ei8ULine truncated
|
||||
|
Before Width: | Height: | Size: 336 KiB After Width: | Height: | Size: 363 KiB |
+96
-65
@@ -3,12 +3,14 @@
|
||||
How one input travels through the agent. Every diamond marked **SemIf** is a
|
||||
real decision-engine call that is logged as a training row; the LLM only ever
|
||||
*generates* (skill drafts, bodies, questions). There is no up-front
|
||||
handle/ignore gate — every input is scored and dispatched.
|
||||
handle/ignore gate — every input is dispatched, and an explicit housekeeping
|
||||
command is routed deterministically before navigation.
|
||||
|
||||
The diagram is split in two: the **main pipeline** (intake → navigation → run →
|
||||
output) and the **authoring pipeline** (what happens when navigation decides a
|
||||
category or skill does not exist yet). Authoring is asynchronous: the main gate
|
||||
is freed immediately and the original request is re-queued once the body lands.
|
||||
The diagram is split in two: the **main pipeline** (intake → dispatch →
|
||||
navigation → run → output) and the **authoring pipeline** (what happens when
|
||||
navigation decides a category or skill does not exist yet). Authoring is
|
||||
asynchronous: the main gate is freed immediately and the original request is
|
||||
re-queued once the body lands.
|
||||
|
||||
Rendered SVG: [flow-main.svg](flow-main.svg) · [flow-authoring.svg](flow-authoring.svg)
|
||||
|
||||
@@ -18,92 +20,102 @@ Rendered SVG: [flow-main.svg](flow-main.svg) · [flow-authoring.svg](flow-author
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
IN["Input<br/>REPL text · gateway DM · dashboard submit"] --> SUB["Scheduler.submit_request()<br/>create Request, trace 'submit'"]
|
||||
IN["Input<br/>REPL text · gateway DM (SimpleX · LXMF · voice) · dashboard submit"] --> SUB["Scheduler.submit_request()<br/>create Request, trace 'submit'"]
|
||||
|
||||
SUB --> BUSY{"current process?"}
|
||||
|
||||
%% ---------- idle path ----------
|
||||
BUSY -- "idle" --> SCORE["SemIf score<br/>phase 'score'<br/>How urgent is this?"]
|
||||
SCORE --> DISPATCH
|
||||
BUSY -- "idle" --> META{"parse_meta_command()<br/>explicit housekeeping command?"}
|
||||
|
||||
%% ---------- busy path ----------
|
||||
BUSY -- "busy" --> INTERRUPT["SemIf choice<br/>phase 'choice'<br/>may this interrupt?"]
|
||||
INTERRUPT -- "defer" --> SCORE2["SemIf score<br/>phase 'score'"]
|
||||
SCORE2 --> PUSH["UrgencyQueue.push<br/>max-heap: weight desc, FIFO seq<br/>age pulls low items toward 1.0"]
|
||||
BUSY -- "busy" --> PUSH["RequestQueue.push<br/>FIFO, bounded"]
|
||||
PUSH -- "full" --> REJECT["Output: rejected<br/>'queue is full'"]
|
||||
PUSH -- "ok" --> QUEUED["Output: queued<br/>urgency label + weight"]
|
||||
QUEUED -. "run_queue when idle" .-> DISPATCH
|
||||
PUSH -- "ok" --> QUEUED["Output: queued"]
|
||||
QUEUED -. "run_queue when idle" .-> META
|
||||
|
||||
INTERRUPT -- "interrupt" --> PREEMPT["Abandon pending run<br/>requeue previous at its weight<br/>trace 'preempted'"]
|
||||
PREEMPT --> DISPATCH["Scheduler._dispatch()"]
|
||||
%% ---------- dispatch ----------
|
||||
META -- "yes" --> HK["run housekeeping leaf<br/>trace 'meta_command'<br/>deterministic; skips navigation"]
|
||||
HK --> RUN["_run_skill()<br/>execute the leaf"]
|
||||
META -- "no" --> NAV["navigate()<br/>descend tree, one SemIf choice per level"]
|
||||
|
||||
%% ---------- navigation ----------
|
||||
DISPATCH --> NAV["navigate()<br/>descend tree, one SemIf choice per level"]
|
||||
%% ---------- actionability guard (top of navigation) ----------
|
||||
NAV --> ACTG{"SemIf choice<br/>phase 'navigate:actionability'<br/>P non_action >= action_tau?"}
|
||||
ACTG -- "non-action" --> CANNEDLEAF["_navigate_canned<br/>phase 'navigate:response'<br/>closed canned reply tree"]
|
||||
CANNEDLEAF --> RUN
|
||||
ACTG -- "request" --> CAT["SemIf choice<br/>phase 'navigate:category'<br/>options = real categories +<br/>descriptions + create_category"]
|
||||
|
||||
NAV --> CAT["SemIf choice<br/>phase 'navigate:category'<br/>options = categories + descriptions<br/>+ create_category"]
|
||||
|
||||
CAT --> CATWIN{"winner =<br/>create_category<br/>or tree empty?"}
|
||||
%% ---------- category selection ----------
|
||||
CAT --> CATWIN{"create_category win<br/>or no categories?"}
|
||||
CATWIN -- "yes" --> CREATECAT["CreateCategory"]
|
||||
CATWIN -- "no" --> CATFIT["SemIf choice<br/>phase 'navigate:category_scope'<br/>P covers >= category_tau?"]
|
||||
CATWIN -- "no" --> CATCONF{"winner prob >=<br/>softmax_bypass_tau?"}
|
||||
CATCONF -- "yes (decisive)" --> HASSKILLS
|
||||
CATCONF -- "no (unsure)" --> CATFIT["SemIf choice<br/>phase 'navigate:category_scope'<br/>P covers >= category_tau?"]
|
||||
CATFIT -- "rejected" --> CREATECAT
|
||||
CATFIT -- "covers" --> CANNED{"category in<br/>CANNED_CATEGORIES?"}
|
||||
CATFIT -- "covers" --> HASSKILLS
|
||||
|
||||
CANNED -- "yes (response)" --> CANNEDLEAF["_navigate_canned<br/>phase 'navigate:response'<br/>closed canned reply tree"]
|
||||
CANNEDLEAF --> RUN["_run_skill()"]
|
||||
|
||||
CANNED -- "no" --> HASSKILLS{"skills in<br/>category?"}
|
||||
%% ---------- leaf selection ----------
|
||||
HASSKILLS{"skills in category?"}
|
||||
HASSKILLS -- "none" --> CREATESKILL["CreateSkill"]
|
||||
HASSKILLS -- "one" --> SOLE["sole skill<br/>softmax skipped"]
|
||||
HASSKILLS -- "many" --> LEAF["SemIf choice<br/>phase 'navigate:leaf'<br/>options = existing skills only"]
|
||||
LEAF --> PICK["picked skill"]
|
||||
LEAF --> PICK["picked skill<br/>+ leaf_softmax_prob"]
|
||||
SOLE --> PICK
|
||||
|
||||
PICK --> INTENT["SemIf choice<br/>phase 'navigate:intent'<br/>P same >= intent_tau?<br/>sole reuse-vs-create guard"]
|
||||
INTENT -- "different" --> CREATESKILL
|
||||
%% ---------- reuse vs create ----------
|
||||
PICK --> HARD{"hard-locked category?<br/>(housekeeping)"}
|
||||
HARD -- "yes" --> RUN
|
||||
HARD -- "no" --> INTENTBYP{"winner prob >=<br/>softmax_bypass_tau?"}
|
||||
INTENTBYP -- "yes (decisive)" --> RUN
|
||||
INTENTBYP -- "no (unsure)" --> INTENT["SemIf choice<br/>phase 'navigate:intent'<br/>P same >= intent_tau?"]
|
||||
INTENT -- "same" --> RUN
|
||||
INTENT -- "different" --> CREATESKILL
|
||||
|
||||
CREATECAT --> AUTHORING(["authoring pipeline<br/>see below"])
|
||||
CREATESKILL --> AUTHORING
|
||||
CREATESKILL --> LOCK{"category locked to<br/>new skills?"}
|
||||
LOCK -- "locked" --> BLOCKED["Output: error<br/>'new-skill creation is locked'"]
|
||||
LOCK -- "open" --> BODYQ{"meta<br/>awaiting_skill_body?"}
|
||||
BODYQ -- "yes" --> PENDINGW["Output: error<br/>'body still being written;<br/>restart category.skill'"]
|
||||
BODYQ -- "no" --> AUTHORING(["authoring pipeline<br/>see below"])
|
||||
|
||||
CREATECAT --> AUTHORING
|
||||
|
||||
%% ---------- run ----------
|
||||
RUN --> WRITING{"leaf still<br/>writing?"}
|
||||
WRITING -- "yes" --> PENDING["Output: error<br/>'body still being written'"]
|
||||
WRITING -- "no (noop stub)" --> NOOP["Output: error<br/>'no body yet; restart <cat> <skill>'"]
|
||||
WRITING -- "runnable" --> RESOLVE["SkillRunner.run()<br/>resolve tiered config<br/>global -> category -> skill"]
|
||||
RUN --> WRITING{"leaf status?"}
|
||||
WRITING -- "writing" --> PENDING["Output: error<br/>'body still being written'"]
|
||||
WRITING -- "stub (no body)" --> NOOP["Output: error<br/>'no body yet;<br/>restart category.skill'"]
|
||||
WRITING -- "ready" --> RESOLVE["SkillRunner.run()<br/>resolve tiered config<br/>global -> category -> skill"]
|
||||
|
||||
RESOLVE --> UNRES{"contract variable<br/>unresolved?"}
|
||||
UNRES -- "yes" --> PAUSE1["Output: needs_input<br/>pre_act pause<br/>ask one variable"]
|
||||
PAUSE1 -. "answer() bypasses gate" .-> RECORD["SemIf choice<br/>phase 'config:record'<br/>record as config vs ask each fire"]
|
||||
PAUSE1 -. "answer() bypasses queue" .-> RECORD["SemIf choice<br/>phase 'config:record'<br/>record as config vs ask each fire"]
|
||||
RECORD --> RESOLVE
|
||||
|
||||
UNRES -- "no" --> ACT["skill.act(ctx, request)<br/>REAL action via stdlib transport<br/>values from ctx.config"]
|
||||
ACT --> ACTNI{"act asks<br/>for input?"}
|
||||
ACT --> ACTNI{"act asks for input?"}
|
||||
ACTNI -- "yes" --> PAUSE2["Output: needs_input<br/>act pause"]
|
||||
PAUSE2 -. "answer()" .-> ACT
|
||||
|
||||
ACTNI -- "no" --> ASSESS
|
||||
|
||||
%% ---------- assessment ----------
|
||||
ASSESS["SemIf choice<br/>phase 'assess:outcome'<br/>P success >= tau?"] --> OK{"success?"}
|
||||
ASSESS["SemIf choice<br/>phase 'assess:outcome'<br/>P success >= tau?<br/>a definitive empty result counts as success"] --> OK{"success?"}
|
||||
OK -- "yes" --> SUMMARY
|
||||
OK -- "no" --> REQ["SemIf choice<br/>phase 'assess:requeue'<br/>complete vs retry"]
|
||||
REQ -- "retry" --> REQUEUE["requeue original request<br/>bounded by max_reentries"]
|
||||
REQUEUE -.-> PUSH
|
||||
REQ -- "complete" --> REPAIR
|
||||
|
||||
SUMMARY["deterministic summary<br/>category.name: ok/failed - action_log"] --> OUT1["Output: ran<br/>REPL print · gateway reply · dashboard trace"]
|
||||
SUMMARY["deterministic summary<br/>category.name: ok/failed - action_log"] --> OUT1["Output: ran<br/>SchedulerReply (run_id, skill_ref, result)<br/>REPL · gateway reply · dashboard trace"]
|
||||
|
||||
REPAIR["SemIf choice<br/>phase 'repair:choice'<br/>retry / repair_skill / ask_user / no_repair"] --> REPAIROUT["Output: repair offer<br/>surfaced in REPL/dashboard/gateway"]
|
||||
REPAIROUT -. "user confirms" .-> AUTHORING
|
||||
|
||||
%% ---------- canned shortcut ----------
|
||||
RUN -. "canned category skips assess" .-> SUMMARY
|
||||
ACT -. "act raises" .-> REPAIR
|
||||
RUN -. "canned / deterministic category skips assess" .-> SUMMARY
|
||||
|
||||
classDef semfill fill:#e8f0fe,stroke:#4285f4,stroke-width:2px;
|
||||
classDef output fill:#fce8e6,stroke:#d93025;
|
||||
classDef author fill:#e6f4ea,stroke:#34a853;
|
||||
class SCORE,SCORE2,INTERRUPT,CAT,CATFIT,LEAF,INTENT,ASSESS,REQ,REPAIR,RECORD semfill;
|
||||
class REJECT,QUEUED,PENDING,NOOP,PAUSE1,PAUSE2,OUT1,REPAIROUT output;
|
||||
class CAT,CATFIT,ACTG,LEAF,INTENT,ASSESS,REQ,REPAIR,RECORD semfill;
|
||||
class REJECT,QUEUED,PENDING,NOOP,PENDINGW,BLOCKED,PAUSE1,PAUSE2,OUT1,REPAIROUT output;
|
||||
class CREATECAT,CREATESKILL,AUTHORING author;
|
||||
```
|
||||
|
||||
@@ -111,37 +123,40 @@ flowchart TD
|
||||
|
||||
## Authoring pipeline (create / repair)
|
||||
|
||||
Entered from `CreateCategory`, `CreateSkill`, or a confirmed repair. Runs in
|
||||
background single-slot workers so the main gate stays free.
|
||||
Entered from `CreateCategory`, `CreateSkill`, or a confirmed repair / regen /
|
||||
restart. Runs in background single-slot workers so the main gate stays free.
|
||||
Only a *create* asks the small `llm` model for a title + description; a
|
||||
repair/regen/restart reuses the existing stub and goes straight to the codegen
|
||||
worker.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
START(["CreateCategory / CreateSkill / repair_skill"]) --> DRAFT["single-slot llm worker<br/>DraftAuthor queue"]
|
||||
START(["CreateCategory / CreateSkill"]) --> DRAFT["single-slot llm worker<br/>DraftAuthor queue"]
|
||||
DIRECT(["repair_skill / regen_skill / restart_skill"]) --> WRITE
|
||||
|
||||
DRAFT --> GEN{"category<br/>or skill?"}
|
||||
DRAFT --> GEN{"category or skill?"}
|
||||
GEN -- "category" --> GC["generate_category()<br/>title + description"]
|
||||
GEN -- "skill" --> GS["generate_skill()<br/>title + description"]
|
||||
GC --> APPROVE
|
||||
GS --> APPROVE
|
||||
|
||||
APPROVE{"creation_approval<br/>on?"}
|
||||
APPROVE{"creation_approval<br/>on? (default off)"}
|
||||
APPROVE -- "no / already approved" --> REGISTER
|
||||
APPROVE -- "yes" --> PROMPT["Output: approval prompt<br/>REPL / dashboard / gateway<br/>deny or timeout aborts"]
|
||||
PROMPT -- "approved" --> REGISTER
|
||||
PROMPT -- "denied / timeout" --> ABORT["Output: creation aborted<br/>nothing registered, not re-dispatched"]
|
||||
PROMPT -- "denied / timeout / no front end" --> ABORT["Output: creation aborted<br/>nothing registered, not re-dispatched"]
|
||||
|
||||
REGISTER["register stub in registry + tree<br/>trace 'category_created' / 'skill_created'"]
|
||||
REGISTER["register stub in registry + tree<br/>seed category config (locks.new_skill)<br/>trace 'category_created' / 'skill_created'"]
|
||||
REGISTER -- "category" --> CHAIN["chain into skill job<br/>approved=true"]
|
||||
CHAIN --> DRAFT
|
||||
REGISTER -- "skill" --> WRITE["single-slot codegen worker<br/>SkillWrite queue<br/>leaf.writing = true"]
|
||||
REGISTER -- "skill" --> WRITE["single-slot codegen worker<br/>SkillWrite queue<br/>leaf.writing = true, trace 'skill_writing'"]
|
||||
|
||||
WRITE --> ELICIT["generate_elicitation()<br/>implementation questions +<br/>integration hint"]
|
||||
WRITE --> ELICIT["generate_elicitation()<br/>implementation questions + integration hint"]
|
||||
ELICIT --> QS["Output: questions<br/>posted one at a time<br/>answer_timeout per question"]
|
||||
QS -- "answers" --> BODY
|
||||
QS -- "timeout" --> BODY
|
||||
QS -- "answers / timeout" --> BODY
|
||||
|
||||
BODY["generate_skill_body()<br/>or regenerate_skill_body() for repair<br/>CODEGEN.md + bridge catalog<br/>declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice<br/>phase 'authoring:fidelity'<br/>accept / reconsider<br/>+ static integration_findings"]
|
||||
FID -- "reconsider" --> BODY
|
||||
BODY["generate_skill_body()<br/>or regenerate_skill_body() for<br/>repair / fidelity / test / manual regen<br/>CODEGEN.md + bridge catalog<br/>declares INTEGRATION + flat CONTRACT"] --> FID["SemIf choice<br/>phase 'authoring:fidelity'<br/>accept / reconsider<br/>+ static integration_findings"]
|
||||
FID -- "reconsider (once)" --> BODY
|
||||
FID -- "accept" --> CONTRACT["parse_contract()<br/>read body's CONTRACT constant"]
|
||||
|
||||
CONTRACT --> CFG["SemIf choice per variable<br/>phase 'config:search'<br/>global -> category -> skill"]
|
||||
@@ -149,20 +164,22 @@ flowchart TD
|
||||
TEST --> RUNTEST["run_skill_test()<br/>subprocess in skill folder"]
|
||||
RUNTEST -- "fail" --> REGEN["SemIf choice<br/>phase 'codegen_regen'<br/>regenerate code / test<br/>bounded by test_max_attempts"]
|
||||
REGEN --> BODY
|
||||
RUNTEST -- "pass" --> MAT["materialize_skill()<br/>write body + contract to data/skills/<br/>hot-merge into tree"]
|
||||
RUNTEST -- "pass" --> MAT["materialize_skill()<br/>write body + contract to data/skills/<br/>hot-merge into tree, trace 'skill_ready'"]
|
||||
|
||||
MAT --> REQ["requeue original request<br/>meta awaiting_skill_body<br/>trace 'skill_requeued'"] --> BACK(["back to main pipeline<br/>re-runs navigation onto new leaf"])
|
||||
|
||||
FAIL["Output: skill_write_failed<br/>leaf stays a restartable stub<br/>restart <cat> <skill>"]
|
||||
FAIL["Output: skill_write_failed<br/>leaf stays a restartable stub<br/>restart category.skill"]
|
||||
BODY -. "CodegenError / ValueError" .-> FAIL
|
||||
RUNTEST -. "budget exhausted" .-> FAIL
|
||||
|
||||
CANCEL["cancel_build meta skill<br/>(housekeeping / CLI / dashboard)"] -. "cancel queued or in-flight write" .-> CANCELLED["Output: build cancelled<br/>discard output, delete half-built leaf"]
|
||||
|
||||
classDef semfill fill:#e8f0fe,stroke:#4285f4,stroke-width:2px;
|
||||
classDef output fill:#fce8e6,stroke:#d93025;
|
||||
classDef author fill:#e6f4ea,stroke:#34a853;
|
||||
class FID,CFG,REGEN semfill;
|
||||
class PROMPT,ABORT,QS,FAIL output;
|
||||
class START,BACK,MAT,REQ author;
|
||||
class PROMPT,ABORT,QS,FAIL,CANCELLED output;
|
||||
class START,DIRECT,BACK,MAT,REQ author;
|
||||
```
|
||||
|
||||
---
|
||||
@@ -171,13 +188,15 @@ flowchart TD
|
||||
|
||||
| Stage | Decision (SemIf) | Phase logged | Output |
|
||||
| --- | --- | --- | --- |
|
||||
| Intake, idle | urgency | `score` | weight → dispatch |
|
||||
| Intake, busy | interrupt? | `choice` | preempt or queue |
|
||||
| Intake, idle | — (no decision) | — | dispatch immediately |
|
||||
| Intake, busy | — (no decision) | — | FIFO queue (arrival order) |
|
||||
| Meta command | — (no decision) | — | route to housekeeping leaf (`meta_command`) |
|
||||
| Actionability | request or not? | `navigate:actionability` | canned reply / category softmax |
|
||||
| Category | which category | `navigate:category` | category / create |
|
||||
| Category scope | does it cover? | `navigate:category_scope` | descend / create |
|
||||
| Category scope | does it cover? | `navigate:category_scope` | descend / create (skipped when decisive) |
|
||||
| Canned | which reply | `navigate:response` | canned line |
|
||||
| Leaf | which skill | `navigate:leaf` | skill |
|
||||
| Intent guard | same action? | `navigate:intent` | run / create |
|
||||
| Intent guard | same action? | `navigate:intent` | run / create (skipped when decisive) |
|
||||
| Config record | record or ask? | `config:record` | persisted / per-fire |
|
||||
| Outcome | did it succeed? | `assess:outcome` | ok / failed |
|
||||
| Requeue | complete or retry? | `assess:requeue` | done / requeue |
|
||||
@@ -189,3 +208,15 @@ flowchart TD
|
||||
**The three terminal outputs** are: a run summary (`category.skill: ok/failed — …`),
|
||||
a question the run is waiting on (`needs_input`), or an offer to fix/learn
|
||||
(`repair_offer`) / an authoring acknowledgement for a brand-new capability.
|
||||
|
||||
**Navigation is two-stage with permissive guards.** The actionability guard runs
|
||||
first and decides whether the input is an actionable request at all; only
|
||||
non-action input reaches the closed `response` tree, so a request is never
|
||||
canned. The category softmax then offers the real categories (never `response`)
|
||||
plus `create_category`, and the leaf softmax offers only the existing skills —
|
||||
the reuse-vs-create decision is the intent guard. A softmax winner at or above
|
||||
`softmax_bypass_tau` (default 0.5) is already decisive, so its confirm guard
|
||||
(scope/intent) is skipped; below it the guard runs and can reject into create.
|
||||
New-skill creation is also gated deterministically by the per-category
|
||||
`locks.new_skill` (the `housekeeping` and `response` categories are hard-locked
|
||||
in code).
|
||||
@@ -2,7 +2,7 @@
|
||||
"_comment": "Committed pin manifest for the external artifacts this repo downloads: the SemIf engine ref, the pinned GGUF, the HF tokenizer revision, and the simplex-chat binary. These are code-owned, deployment-independent values bumped by a git change and picked up on the next `scripts/bootstrap.sh` run. They are deliberately NOT in config.json (per-machine user config): a ref that changes with every update is not user configuration. The agent reads engine.source/revision from here; the GGUF path is derived from engine.gguf_url unless config.json overrides engine.gguf.",
|
||||
"engine": {
|
||||
"semif_repo": "https://github.com/TheoLeeCJ/SemIf.git",
|
||||
"semif_ref": "1f2dea3e25379f9dfc98cb83c324f00ab5deda37",
|
||||
"semif_ref": "23cf1f39fc9534fe81437200959b6dfc7106e45a",
|
||||
"gguf_url": "https://huggingface.co/bartowski/Qwen_Qwen3.5-4B-GGUF/resolve/main/Qwen_Qwen3.5-4B-Q4_K_M.gguf",
|
||||
"gguf_sha256": "13c16f426047e2de38cd075bdade4a7bcbc8c774384876f677740cda65f8a983",
|
||||
"source": "Qwen/Qwen3.5-4B",
|
||||
|
||||
+92
-5
@@ -32,7 +32,7 @@
|
||||
#
|
||||
# Usage:
|
||||
# scripts/bootstrap.sh [--llm-url URL] [--codegen-url URL] [--llm-model MODEL]
|
||||
# [--codegen-model MODEL] [--copy-data SRC] [--voice] [-h]
|
||||
# [--codegen-model MODEL] [--copy-data SRC] [--voice] [--gpu MODE] [-h]
|
||||
#
|
||||
# Run as the human user; sudo is used internally for system bits.
|
||||
set -euo pipefail
|
||||
@@ -43,6 +43,7 @@ LLM_MODEL=""
|
||||
CODEGEN_MODEL=""
|
||||
COPY_DATA=""
|
||||
VOICE=0
|
||||
GPU_MODE="auto"
|
||||
|
||||
usage() {
|
||||
sed -n '2,35p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
|
||||
@@ -53,6 +54,7 @@ usage() {
|
||||
echo " --codegen-model MODEL override codegen.model from config.json for this run"
|
||||
echo " --copy-data SRC rsync SRC (e.g. user@host:/path/to/semif-agent/data) to data/ — opt-in"
|
||||
echo " --voice install the optional voice-gateway stack + download its models"
|
||||
echo " --gpu MODE decision-engine llama.cpp backend: auto (default; a GPU build only when engine.gpu_layers is set), vulkan, rocm, cuda, cpu"
|
||||
echo " -h this help"
|
||||
exit "${1:-0}"
|
||||
}
|
||||
@@ -65,6 +67,7 @@ while [[ $# -gt 0 ]]; do
|
||||
--codegen-model) CODEGEN_MODEL="$2"; shift 2 ;;
|
||||
--copy-data) COPY_DATA="$2"; shift 2 ;;
|
||||
--voice) VOICE=1; shift ;;
|
||||
--gpu) GPU_MODE="$2"; shift 2 ;;
|
||||
-h|--help) usage 0 ;;
|
||||
*) echo "unknown option: $1" >&2; usage 1 ;;
|
||||
esac
|
||||
@@ -136,7 +139,7 @@ if [[ -z "$SIMPLEX_BIN_URL" || -z "$SIMPLEX_SHA256" ]]; then
|
||||
fi
|
||||
|
||||
# --- read per-machine values from config.json (flags override for this run) --
|
||||
IFS=$'\x1f' read -r CFG_LLM_URL CFG_LLM_MODEL CFG_CODEGEN_URL CFG_CODEGEN_MODEL \
|
||||
IFS=$'\x1f' read -r CFG_LLM_URL CFG_LLM_MODEL CFG_LLM_PROVIDER CFG_CODEGEN_URL CFG_CODEGEN_MODEL \
|
||||
SIMPLEX_PORT SIMPLEX_DISPLAY SIMPLEX_FORWARD_PORT SIMPLEX_FORWARD_DISPLAY < <(
|
||||
python3 - "$CONFIG" <<'PY'
|
||||
import json, sys
|
||||
@@ -148,6 +151,7 @@ def strip_v1(u):
|
||||
print("\x1f".join([
|
||||
strip_v1(cfg.get("llm", {}).get("base_url")),
|
||||
str(cfg.get("llm", {}).get("model", "") or ""),
|
||||
str(cfg.get("llm", {}).get("provider", "ollama") or "ollama").lower(),
|
||||
strip_v1(cfg.get("codegen", {}).get("base_url")),
|
||||
str(cfg.get("codegen", {}).get("model", "") or ""),
|
||||
str(s.get("port", "")),
|
||||
@@ -163,6 +167,7 @@ LLM_URL="${LLM_URL:-${CFG_LLM_URL:-http://127.0.0.1:11434}}"
|
||||
CODEGEN_URL="${CODEGEN_URL:-$CFG_CODEGEN_URL}"
|
||||
LLM_MODEL="${LLM_MODEL:-$CFG_LLM_MODEL}"
|
||||
CODEGEN_MODEL="${CODEGEN_MODEL:-$CFG_CODEGEN_MODEL}"
|
||||
LLM_PROVIDER="${LLM_PROVIDER:-${CFG_LLM_PROVIDER:-ollama}}"
|
||||
|
||||
if [[ -z "$SIMPLEX_PORT" || -z "$SIMPLEX_FORWARD_PORT" ]]; then
|
||||
echo "config.json: simplex_chat.port and simplex_chat.forward_port are required" >&2
|
||||
@@ -178,7 +183,11 @@ with_v1() { local u="${1%/}"; [[ "$u" == */v1 ]] && printf '%s' "$u" || printf '
|
||||
LLM_V1="$(with_v1 "$LLM_URL")"
|
||||
|
||||
echo "== pins: semif @ $SEMIF_REF | gguf sha256 ${GGUF_SHA256:0:12}… | simplex-chat sha256 ${SIMPLEX_SHA256:0:12}…"
|
||||
echo "== llm $LLM_URL (local, model $LLM_MODEL) | codegen $CODEGEN_URL"
|
||||
if [[ "$LLM_PROVIDER" == "semif" ]]; then
|
||||
echo "== llm semif (in-process engine model) | codegen $CODEGEN_URL"
|
||||
else
|
||||
echo "== llm $LLM_URL (local, model $LLM_MODEL) | codegen $CODEGEN_URL"
|
||||
fi
|
||||
echo "== runtime tree: $RUNTIME"
|
||||
|
||||
mkdir -p "$RUNTIME" "$MODELS" "$HF_CACHE" "$TOOLDIR" "$SIMPLEX_DB" "$RUNTIME/simplex-forward" "$RUNTIME/lxmf" "$RUNTIME/voice" "$UNITS" "$USER_UNITS"
|
||||
@@ -233,6 +242,65 @@ if [[ "$(git -C "$ENGINE" rev-parse HEAD 2>/dev/null)" != "$SEMIF_REF" ]]; then
|
||||
git -C "$ENGINE" checkout "$SEMIF_REF"
|
||||
fi
|
||||
|
||||
# --- stage 2b: pick the llama.cpp GPU backend ---------------------------------
|
||||
# The decision engine scores the GGUF through llama.cpp, which runs on CPU
|
||||
# unless llama-cpp-python was built with a GPU backend. A GPU-enabled build is
|
||||
# opt-in: llama.cpp's Vulkan backend splits the compute graph across CPU and
|
||||
# Vulkan even with `n_gpu_layers=0`, roughly doubling CPU latency, so a CPU-only
|
||||
# host must not get one. `--gpu <backend>` forces a build; `--gpu auto` (the
|
||||
# default) builds a GPU backend only when config.json asks for offload
|
||||
# (`engine.gpu_layers` nonzero).
|
||||
CONFIG_GPU_LAYERS="$(python3 - "$CONFIG" <<'PY'
|
||||
import json, sys
|
||||
try:
|
||||
print(int(json.load(open(sys.argv[1])).get("engine", {}).get("gpu_layers", 0) or 0))
|
||||
except Exception:
|
||||
print(0)
|
||||
PY
|
||||
)"
|
||||
detect_gpu_backend() {
|
||||
if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi >/dev/null 2>&1; then
|
||||
echo cuda; return
|
||||
fi
|
||||
if [[ -d /opt/rocm ]]; then
|
||||
echo rocm; return
|
||||
fi
|
||||
if command -v glslc >/dev/null 2>&1 && compgen -G "/usr/share/vulkan/icd.d/*.json" >/dev/null; then
|
||||
echo vulkan; return
|
||||
fi
|
||||
echo cpu
|
||||
}
|
||||
case "$GPU_MODE" in
|
||||
cpu) GPU_BACKEND=cpu ;;
|
||||
vulkan|rocm|cuda) GPU_BACKEND="$GPU_MODE" ;;
|
||||
auto)
|
||||
if [[ "$CONFIG_GPU_LAYERS" != 0 ]]; then
|
||||
GPU_BACKEND="$(detect_gpu_backend)"
|
||||
else
|
||||
GPU_BACKEND=cpu
|
||||
fi
|
||||
;;
|
||||
*) echo "unknown --gpu mode: $GPU_MODE (want auto, vulkan, rocm, cuda, cpu)" >&2; exit 2 ;;
|
||||
esac
|
||||
case "$GPU_BACKEND" in
|
||||
vulkan) LLAMA_CMAKE_ARGS="-DGGML_VULKAN=on" ;;
|
||||
rocm) LLAMA_CMAKE_ARGS="-DGGML_HIP=on" ;;
|
||||
cuda) LLAMA_CMAKE_ARGS="-DGGML_CUDA=on" ;;
|
||||
*) LLAMA_CMAKE_ARGS="" ;;
|
||||
esac
|
||||
echo "== decision-engine llama.cpp backend: $GPU_BACKEND (engine.gpu_layers=$CONFIG_GPU_LAYERS)"
|
||||
|
||||
if [[ "$GPU_BACKEND" = vulkan ]]; then
|
||||
VULKAN_PKGS=(libvulkan-dev glslc spirv-headers glslang-tools)
|
||||
vk_missing=()
|
||||
for p in "${VULKAN_PKGS[@]}"; do dpkg -s "$p" >/dev/null 2>&1 || vk_missing+=("$p"); done
|
||||
if [[ ${#vk_missing[@]} -gt 0 ]]; then
|
||||
echo "== installing Vulkan build prereqs: ${vk_missing[*]}"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y "${vk_missing[@]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- stage 3: venv + deps -------------------------------------------------------
|
||||
if [[ ! -x "$PYTHON" ]]; then
|
||||
echo "== creating venv at $VENV"
|
||||
@@ -241,7 +309,22 @@ fi
|
||||
echo "== installing engine deps into $VENV"
|
||||
"$PIP" install --upgrade pip setuptools wheel
|
||||
"$PIP" install -e "$ENGINE" --no-deps
|
||||
CMAKE_BUILD_PARALLEL_LEVEL=6 MAKEFLAGS=-j6 "$PIP" install -r "$REPO_ROOT/requirements/staging.txt"
|
||||
CMAKE_ARGS="$LLAMA_CMAKE_ARGS" CMAKE_BUILD_PARALLEL_LEVEL=6 MAKEFLAGS=-j6 \
|
||||
"$PIP" install -r "$REPO_ROOT/requirements/staging.txt"
|
||||
|
||||
# Make the installed llama-cpp-python match the requested backend: pip ships a
|
||||
# CPU wheel and its wheel cache hands it back even when CMAKE_ARGS asks for a
|
||||
# GPU backend, so force a source build whenever offload support disagrees.
|
||||
installed_gpu=no
|
||||
"$PYTHON" -c 'import llama_cpp, sys; sys.exit(0 if llama_cpp.llama_supports_gpu_offload() else 1)' 2>/dev/null && installed_gpu=yes
|
||||
want_gpu=yes
|
||||
[[ "$GPU_BACKEND" = cpu ]] && want_gpu=no
|
||||
if [[ "$installed_gpu" != "$want_gpu" ]]; then
|
||||
LLAMA_PIN="$(grep -m1 -E '^llama-cpp-python==' "$REPO_ROOT/requirements/staging.txt")"
|
||||
echo "== rebuilding llama-cpp-python for the $GPU_BACKEND backend ($LLAMA_PIN)"
|
||||
CMAKE_ARGS="$LLAMA_CMAKE_ARGS" CMAKE_BUILD_PARALLEL_LEVEL=6 MAKEFLAGS=-j6 \
|
||||
"$PIP" install --no-deps --force-reinstall --no-cache-dir --no-binary llama-cpp-python "$LLAMA_PIN"
|
||||
fi
|
||||
"$PIP" install -e "$REPO_ROOT" --no-deps
|
||||
|
||||
# --- stage 3b: optional voice-gateway stack (--voice) --------------------------
|
||||
@@ -430,7 +513,11 @@ echo "== verifying imports"
|
||||
|
||||
# The small self-assessment model runs on this machine's local ollama; ensure it
|
||||
# is pulled so assess/elicitation/fidelity work without a remote dependency.
|
||||
if [[ -z "$LLM_MODEL" ]]; then
|
||||
# With llm.provider == "semif" the loaded decision engine generates the text
|
||||
# in-process, so no ollama model/endpoint is involved.
|
||||
if [[ "$LLM_PROVIDER" == "semif" ]]; then
|
||||
echo "== llm provider semif: the loaded engine model generates text in-process (no ollama pull/probe)"
|
||||
elif [[ -z "$LLM_MODEL" ]]; then
|
||||
echo "WARN: llm.model is not set in config.json — set it (and codegen.model) before starting the agent" >&2
|
||||
else
|
||||
echo "== llm ollama ($LLM_API), model $LLM_MODEL"
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Break down voice-gateway latency from the run trace.
|
||||
|
||||
Reads `data/runs.jsonl` (written by the running gateway) and, for each spoken
|
||||
interaction, reports the time between the **last word spoken** and the **first
|
||||
reply audio** split by section:
|
||||
|
||||
last word ── endpointing ── STT ── adapter ── [scheduler: guards + act + assess]
|
||||
── reply routing (humanize) ── TTS synth ── playback start
|
||||
|
||||
The voice transport emits `voice_speech_end` at the last speech frame and
|
||||
`voice_playback_start` right before the first reply samples reach the device;
|
||||
the scheduler emits `submit`/`actionability`/`category_scope`/`intent_guard`/
|
||||
`assessed`/`ran`; the service emits `humanize`/`gateway_reply_queued` and the
|
||||
adapter `gateway_reply_dequeued`/`voice_speak_start`/`voice_tts_synth`.
|
||||
|
||||
Usage:
|
||||
python scripts/voice-latency.py [data/runs.jsonl] [--json] [--decisions PATH]
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import statistics
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def load_rows(path: str) -> list[dict]:
|
||||
rows = []
|
||||
if not Path(path).is_file():
|
||||
return rows
|
||||
with open(path) as handle:
|
||||
for line in handle:
|
||||
line = line.strip()
|
||||
if line:
|
||||
rows.append(json.loads(line))
|
||||
return rows
|
||||
|
||||
|
||||
def _first(events: list[dict], kind: str) -> dict | None:
|
||||
return next((e for e in events if e.get("kind") == kind), None)
|
||||
|
||||
|
||||
def _ts(event: dict | None) -> float | None:
|
||||
return None if event is None else event.get("ts")
|
||||
|
||||
|
||||
def build_interactions(rows: list[dict]) -> list[dict]:
|
||||
"""Split the trace into spoken interactions, each from speech-end to reply-end."""
|
||||
interactions: list[dict] = []
|
||||
current: dict | None = None
|
||||
for event in rows:
|
||||
kind = event.get("kind")
|
||||
if kind == "voice_speech_end" or (
|
||||
kind == "voice_utterance" and current is None
|
||||
):
|
||||
# A new utterance begins; close any prior interaction at its reply
|
||||
# end. `voice_utterance` also starts one on legacy traces that
|
||||
# predate the `voice_speech_end` probe (last-word boundary unknown).
|
||||
if current is not None:
|
||||
interactions.append(current)
|
||||
current = {"events": [event]}
|
||||
elif current is not None:
|
||||
current["events"].append(event)
|
||||
if kind in ("voice_spoke", "voice_speak_failed", "voice_stt_empty",
|
||||
"voice_stt_failed", "voice_short_utterance"):
|
||||
interactions.append(current)
|
||||
current = None
|
||||
if current is not None:
|
||||
interactions.append(current)
|
||||
return interactions
|
||||
|
||||
|
||||
def _decisions_timing(decisions_path: str) -> dict[str, list[dict]]:
|
||||
"""Map run_id -> list of {phase, timing} from the decision log."""
|
||||
by_run: dict[str, list[dict]] = {}
|
||||
if not Path(decisions_path).is_file():
|
||||
return by_run
|
||||
with open(decisions_path) as handle:
|
||||
for line in handle:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
row = json.loads(line)
|
||||
extra = row.get("extra") or {}
|
||||
run_id = extra.get("run_id")
|
||||
timing = extra.get("timing")
|
||||
if run_id and timing:
|
||||
by_run.setdefault(run_id, []).append(
|
||||
{"phase": extra.get("phase"), **timing}
|
||||
)
|
||||
return by_run
|
||||
|
||||
|
||||
def analyze(interaction: dict, decisions: dict[str, list[dict]]) -> dict | None:
|
||||
events = interaction["events"]
|
||||
speech_end = _first(events, "voice_speech_end")
|
||||
utterance = _first(events, "voice_utterance")
|
||||
transcribed = _first(events, "voice_transcribed")
|
||||
submit = _first(events, "submit")
|
||||
if utterance is None or submit is None:
|
||||
return None # empty/short utterance: nothing was dispatched
|
||||
# On legacy traces without `voice_speech_end`, measure from the utterance.
|
||||
origin = speech_end or utterance
|
||||
|
||||
actionability = _first(events, "actionability")
|
||||
category_scope = _first(events, "category_scope")
|
||||
intent_guard = _first(events, "intent_guard")
|
||||
assessed = _first(events, "assessed")
|
||||
ran = _first(events, "ran")
|
||||
reply_queued = _first(events, "gateway_reply_queued")
|
||||
reply_dequeued = _first(events, "gateway_reply_dequeued")
|
||||
speak_start = _first(events, "voice_speak_start")
|
||||
tts = _first(events, "voice_tts_synth")
|
||||
playback = _first(events, "voice_playback_start")
|
||||
spoke = _first(events, "voice_spoke")
|
||||
humanize = _first(events, "humanize")
|
||||
|
||||
t0 = _ts(origin)
|
||||
run_id = submit.get("run_id")
|
||||
|
||||
def delta(a: dict | None, b: dict | None) -> float | None:
|
||||
ta, tb = _ts(a), _ts(b)
|
||||
return None if ta is None or tb is None else round(tb - ta, 3)
|
||||
|
||||
out = {
|
||||
"run_id": run_id,
|
||||
"text": submit.get("text"),
|
||||
"skill": (ran or {}).get("skill"),
|
||||
"summary": (ran or {}).get("summary"),
|
||||
"last_word_ts": t0,
|
||||
"endpointing_s": delta(speech_end, utterance),
|
||||
"stt_s": delta(utterance, transcribed),
|
||||
"adapter_s": delta(transcribed, submit),
|
||||
"scheduler_s": delta(submit, ran),
|
||||
"guard_actionability_s": delta(submit, actionability),
|
||||
"guard_category_s": delta(actionability, category_scope),
|
||||
"guard_intent_s": delta(category_scope, intent_guard),
|
||||
"act_assess_s": delta(intent_guard, assessed),
|
||||
"assess_ran_s": delta(assessed, ran),
|
||||
"reply_s": delta(ran, playback),
|
||||
"humanize_s": (humanize or {}).get("elapsed_s"),
|
||||
"tts_synth_s": (tts or {}).get("synth_s"),
|
||||
"tts_audio_s": (tts or {}).get("audio_s"),
|
||||
"queue_s": delta(reply_queued, reply_dequeued),
|
||||
"speak_to_playback_s": delta(speak_start, playback),
|
||||
"playback_s": delta(playback, spoke),
|
||||
"total_to_first_audio_s": delta(origin, playback),
|
||||
"total_to_reply_end_s": delta(origin, spoke),
|
||||
"decisions": decisions.get(run_id, []),
|
||||
}
|
||||
# Anything after `ran` but before playback that is not humanize/TTS is queue.
|
||||
if out["reply_s"] is not None:
|
||||
accounted = (out["humanize_s"] or 0.0) + (out["tts_synth_s"] or 0.0)
|
||||
out["reply_unaccounted_s"] = round(out["reply_s"] - accounted, 3)
|
||||
return out
|
||||
|
||||
|
||||
def fmt(value) -> str:
|
||||
return "—" if value is None else f"{value:.2f}"
|
||||
|
||||
|
||||
def render(results: list[dict]) -> None:
|
||||
for r in results:
|
||||
print(f"\nrun {r['run_id']} {r['text']!r} skill={r['skill']}")
|
||||
print(f" last word → endpointing done : {fmt(r['endpointing_s'])} s")
|
||||
print(f" STT : {fmt(r['stt_s'])} s")
|
||||
print(f" adapter → scheduler submit : {fmt(r['adapter_s'])} s")
|
||||
print(f" SCHEDULER total : {fmt(r['scheduler_s'])} s")
|
||||
print(f" actionability guard : {fmt(r['guard_actionability_s'])} s")
|
||||
print(f" category softmax + scope : {fmt(r['guard_category_s'])} s")
|
||||
print(f" leaf softmax + intent : {fmt(r['guard_intent_s'])} s")
|
||||
print(f" act + assess:outcome : {fmt(r['act_assess_s'])} s")
|
||||
print(f" assess → ran : {fmt(r['assess_ran_s'])} s")
|
||||
print(f" reply (ran → first audio) : {fmt(r['reply_s'])} s")
|
||||
print(f" humanize : {fmt(r['humanize_s'])} s")
|
||||
print(f" TTS synth : {fmt(r['tts_synth_s'])} s")
|
||||
print(f" other (queue/open) : {fmt(r.get('reply_unaccounted_s'))} s")
|
||||
print(f" playback (audio duration) : {fmt(r['playback_s'])} s")
|
||||
print(f" ── LAST WORD → FIRST AUDIO : {fmt(r['total_to_first_audio_s'])} s")
|
||||
if r["decisions"]:
|
||||
for d in r["decisions"]:
|
||||
print(
|
||||
f" [{d.get('phase')}] tokens={d.get('input_tokens')} "
|
||||
f"forward={d.get('forward_seconds')} total={d.get('total_seconds')}"
|
||||
)
|
||||
|
||||
def agg(key: str) -> str:
|
||||
vals = [r[key] for r in results if r.get(key) is not None]
|
||||
if not vals:
|
||||
return "—"
|
||||
return f"median {statistics.median(vals):.2f}s mean {statistics.mean(vals):.2f}s (n={len(vals)})"
|
||||
|
||||
print("\n===== aggregate =====")
|
||||
for key, label in (
|
||||
("endpointing_s", "endpointing"),
|
||||
("stt_s", "STT"),
|
||||
("scheduler_s", "SCHEDULER"),
|
||||
("guard_actionability_s", " actionability"),
|
||||
("guard_category_s", " category softmax+scope"),
|
||||
("guard_intent_s", " leaf softmax+intent"),
|
||||
("act_assess_s", " act+assess"),
|
||||
("reply_s", "reply (humanize+TTS)"),
|
||||
("humanize_s", " humanize"),
|
||||
("tts_synth_s", " TTS synth"),
|
||||
("total_to_first_audio_s", "TOTAL last word → first audio"),
|
||||
):
|
||||
print(f"{label:28s}: {agg(key)}")
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("trace", nargs="?", default="data/runs.jsonl")
|
||||
parser.add_argument("--decisions", default="data/decisions.jsonl")
|
||||
parser.add_argument("--json", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
rows = load_rows(args.trace)
|
||||
decisions = _decisions_timing(args.decisions)
|
||||
results = []
|
||||
for interaction in build_interactions(rows):
|
||||
analyzed = analyze(interaction, decisions)
|
||||
if analyzed is not None:
|
||||
results.append(analyzed)
|
||||
if args.json:
|
||||
print(json.dumps(results, indent=2))
|
||||
return 0
|
||||
if not results:
|
||||
print("no spoken interactions found in", args.trace)
|
||||
return 1
|
||||
render(results)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -37,6 +37,7 @@ from datetime import datetime, time, timedelta, timezone
|
||||
|
||||
from semif_agent.decisions import DecisionRequest, Option
|
||||
from semif_agent.skills import ActionResult
|
||||
from semif_agent.timers import local_now
|
||||
|
||||
INTEGRATION = {
|
||||
"service": "nextcloud_calendar",
|
||||
@@ -125,9 +126,10 @@ class BridgeError(Exception):
|
||||
"""A real failure talking to the local LLM bridge."""
|
||||
|
||||
|
||||
def _now():
|
||||
"""Current local time (aware). A test seam; the body never freezes time."""
|
||||
return datetime.now().astimezone()
|
||||
def _now(ctx):
|
||||
"""Current time (aware) in the user's timezone: the top-level `timezone`
|
||||
config value when set, else host local. A test seam; never freezes time."""
|
||||
return local_now(ctx.config)
|
||||
|
||||
|
||||
# ---- transport ----
|
||||
@@ -504,7 +506,7 @@ def _build_ics(uid, summary, start, end, all_day, stamp, description=""):
|
||||
def _ask(request, field, question):
|
||||
request.meta["create_event_awaiting"] = field
|
||||
return ActionResult(
|
||||
action_log=f"calendar.create_event: waiting for {field}",
|
||||
action_log=f"waiting for {field}",
|
||||
new_state=request.text,
|
||||
needs_input=question,
|
||||
)
|
||||
@@ -524,14 +526,14 @@ def act(ctx, request):
|
||||
fields = _extract_fields(ctx, request)
|
||||
except BridgeError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"calendar.create_event: {exc}",
|
||||
action_log=str(exc),
|
||||
new_state=request.text,
|
||||
)
|
||||
request.meta["create_event_fields"] = fields
|
||||
title = fields["title"]
|
||||
description = fields["description"]
|
||||
|
||||
now = _now()
|
||||
now = _now(ctx)
|
||||
parsed = _parse_when(request.text, now)
|
||||
|
||||
if answers.get("title"):
|
||||
@@ -574,12 +576,12 @@ def act(ctx, request):
|
||||
calendars = _discover_calendars(ctx)
|
||||
except CalDavError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"calendar.create_event: calendar discovery failed: {exc}",
|
||||
action_log=f"calendar discovery failed: {exc}",
|
||||
new_state=request.text,
|
||||
)
|
||||
if not calendars:
|
||||
return ActionResult(
|
||||
action_log="calendar.create_event: no calendars found on the account",
|
||||
action_log="no calendars found on the account",
|
||||
new_state=request.text,
|
||||
)
|
||||
|
||||
@@ -604,7 +606,7 @@ def act(ctx, request):
|
||||
except CalDavError as exc:
|
||||
return ActionResult(
|
||||
action_log=(
|
||||
f"calendar.create_event: could not create {title!r} on "
|
||||
f"could not create {title!r} on "
|
||||
f"{calendar!r}: {exc}"
|
||||
),
|
||||
new_state=request.text,
|
||||
@@ -620,7 +622,7 @@ def act(ctx, request):
|
||||
)
|
||||
report = f"Created {title!r} on calendar {calendar!r}: {when_text} (UID {uid})."
|
||||
return ActionResult(
|
||||
action_log=f"calendar.create_event: {report}",
|
||||
action_log=report,
|
||||
new_state=report,
|
||||
decisions=decisions,
|
||||
)
|
||||
@@ -25,7 +25,7 @@ from semif_agent.skills import ActionContext
|
||||
import skill
|
||||
|
||||
FIXED_NOW = datetime(2026, 10, 7, 10, 0, tzinfo=timezone.utc)
|
||||
skill._now = lambda: FIXED_NOW
|
||||
skill._now = lambda ctx: FIXED_NOW
|
||||
|
||||
DEFAULT_LLM_REPLY = {"title": "event", "description": ""}
|
||||
|
||||
@@ -422,7 +422,7 @@ def test_unreachable_server_fails_honestly():
|
||||
action, request, _engine = run(
|
||||
None, "http://127.0.0.1:1", "add standup on 2026-11-10 at 9am"
|
||||
)
|
||||
assert action.action_log.startswith("calendar.create_event:"), action.action_log
|
||||
assert action.action_log and "calendar.create_event" not in action.action_log, action.action_log
|
||||
assert action.new_state == request.text
|
||||
print(action.action_log)
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ from zoneinfo import ZoneInfo
|
||||
|
||||
from semif_agent.decisions import DecisionRequest, Option
|
||||
from semif_agent.skills import ActionResult
|
||||
from semif_agent.timers import local_now
|
||||
|
||||
INTEGRATION = {
|
||||
"service": "nextcloud_calendar",
|
||||
@@ -76,9 +77,10 @@ class CalDavError(Exception):
|
||||
"""A real failure talking to the calendar service."""
|
||||
|
||||
|
||||
def _now():
|
||||
"""Current local time (aware). A test seam; the body never freezes time."""
|
||||
return datetime.now().astimezone()
|
||||
def _now(ctx):
|
||||
"""Current time (aware) in the user's timezone: the top-level `timezone`
|
||||
config value when set, else host local. A test seam; never freezes time."""
|
||||
return local_now(ctx.config)
|
||||
|
||||
|
||||
# ---- transport ----
|
||||
@@ -360,12 +362,12 @@ def act(ctx, request):
|
||||
calendars = _discover_calendars(ctx)
|
||||
except CalDavError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"calendar.next_event: calendar discovery failed: {exc}",
|
||||
action_log=f"calendar discovery failed: {exc}",
|
||||
new_state=request.text,
|
||||
)
|
||||
if not calendars:
|
||||
return ActionResult(
|
||||
action_log="calendar.next_event: calendar discovery failed: no calendars found",
|
||||
action_log="calendar discovery failed: no calendars found",
|
||||
new_state=request.text,
|
||||
)
|
||||
|
||||
@@ -373,12 +375,12 @@ def act(ctx, request):
|
||||
calendar = _resolve_calendar(ctx, request, calendars, decisions)
|
||||
if not calendar:
|
||||
return ActionResult(
|
||||
action_log="calendar.next_event aborted: no calendar resolved.",
|
||||
action_log="aborted: no calendar resolved.",
|
||||
new_state=request.text,
|
||||
decisions=decisions,
|
||||
)
|
||||
|
||||
now = _now()
|
||||
now = _now(ctx)
|
||||
local_tz = now.tzinfo or timezone.utc
|
||||
window_start = now - timedelta(days=1)
|
||||
window_end = now + timedelta(days=LOOKAHEAD_DAYS)
|
||||
@@ -393,7 +395,7 @@ def act(ctx, request):
|
||||
events = _parse_events(_calendar_payloads(body), local_tz)
|
||||
except CalDavError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"calendar.next_event failed on {calendar!r}: {exc}",
|
||||
action_log=f"failed on {calendar!r}: {exc}",
|
||||
new_state=request.text,
|
||||
decisions=decisions,
|
||||
)
|
||||
|
||||
@@ -73,19 +73,17 @@ def act(ctx, request):
|
||||
try:
|
||||
payload = _get(ctx, "/health")
|
||||
except BridgeError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"simplex.connect_link: {exc}", new_state=request.text
|
||||
)
|
||||
return ActionResult(action_log=str(exc), new_state=request.text)
|
||||
if not payload.get("ok"):
|
||||
return ActionResult(
|
||||
action_log="simplex.connect_link: simplex forwarding bridge is not healthy",
|
||||
action_log="simplex forwarding bridge is not healthy",
|
||||
new_state=request.text,
|
||||
)
|
||||
try:
|
||||
payload = _get(ctx, "/address")
|
||||
except BridgeError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"simplex.connect_link failed: {exc}",
|
||||
action_log=f"reading the contact link failed: {exc}",
|
||||
new_state=request.text,
|
||||
)
|
||||
short = str(payload.get("short_link") or "").strip()
|
||||
@@ -93,7 +91,7 @@ def act(ctx, request):
|
||||
if not (short or full):
|
||||
return ActionResult(
|
||||
action_log=(
|
||||
"simplex.connect_link: the bridge returned no SimpleX "
|
||||
"the bridge returned no SimpleX "
|
||||
"contact link; the bot has no address yet."
|
||||
),
|
||||
new_state=request.text,
|
||||
|
||||
@@ -135,7 +135,7 @@ def test_unreachable_bridge_fails_honestly():
|
||||
ctx = ActionContext(engine=None, config=config("http://127.0.0.1:1"))
|
||||
request = Request("give me your simplex link")
|
||||
action = skill.act(ctx, request)
|
||||
assert action.action_log.startswith("simplex.connect_link:"), action.action_log
|
||||
assert action.action_log and "simplex.connect_link" not in action.action_log, action.action_log
|
||||
assert action.new_state == request.text
|
||||
print(action.action_log)
|
||||
|
||||
|
||||
@@ -140,11 +140,11 @@ def act(ctx, request):
|
||||
try:
|
||||
payload = _get(ctx, "/inbox")
|
||||
except BridgeError as exc:
|
||||
return ActionResult(action_log=f"simplex.next_message: {exc}", new_state=request.text)
|
||||
return ActionResult(action_log=str(exc), new_state=request.text)
|
||||
senders = _senders(payload.get("messages") or [])
|
||||
if not senders:
|
||||
return ActionResult(
|
||||
action_log="simplex.next_message: no unread SimpleX messages.",
|
||||
action_log="no unread SimpleX messages.",
|
||||
new_state="no unread SimpleX messages",
|
||||
)
|
||||
decisions = []
|
||||
@@ -155,14 +155,14 @@ def act(ctx, request):
|
||||
)
|
||||
except BridgeError as exc:
|
||||
return ActionResult(
|
||||
action_log=f"simplex.next_message failed reading {contact!r}: {exc}",
|
||||
action_log=f"failed reading {contact!r}: {exc}",
|
||||
new_state=request.text,
|
||||
decisions=decisions,
|
||||
)
|
||||
message = payload.get("message")
|
||||
if not message:
|
||||
return ActionResult(
|
||||
action_log=f"simplex.next_message: no unread message from {contact!r}.",
|
||||
action_log=f"no unread message from {contact!r}.",
|
||||
new_state="no unread SimpleX messages",
|
||||
decisions=decisions,
|
||||
)
|
||||
|
||||
@@ -237,7 +237,7 @@ def test_unreachable_bridge_fails_honestly():
|
||||
ctx = ActionContext(engine=engine, config=config("http://127.0.0.1:1"))
|
||||
request = Request("read my next simplex message")
|
||||
action = skill.act(ctx, request)
|
||||
assert action.action_log.startswith("simplex.next_message:"), action.action_log
|
||||
assert action.action_log and "simplex.next_message" not in action.action_log, action.action_log
|
||||
assert action.new_state == request.text, "a failed read must not fake a result"
|
||||
print(action.action_log)
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"""Report today's date.
|
||||
|
||||
Real local compute: reads the host clock and formats the local calendar date.
|
||||
No external service and no configuration.
|
||||
Real local compute: reads the host clock and formats the calendar date in the
|
||||
user's timezone — the top-level `timezone` config value (an IANA name) when set,
|
||||
otherwise the host's local timezone. No external service.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from semif_agent.skills import ActionResult
|
||||
from semif_agent.timers import local_now
|
||||
|
||||
INTEGRATION = {"service": "local_clock", "transport": "compute", "config_vars": []}
|
||||
|
||||
@@ -16,6 +16,6 @@ CONTRACT = {}
|
||||
|
||||
|
||||
def act(ctx, request):
|
||||
today = datetime.now().astimezone().date()
|
||||
today = local_now(ctx.config).date()
|
||||
message = f"Today is {today.strftime('%A, %B %d, %Y')} ({today.isoformat()})."
|
||||
return ActionResult(action_log=f"time.date: {message}", new_state=message)
|
||||
return ActionResult(action_log=message, new_state=message)
|
||||
@@ -1,8 +1,10 @@
|
||||
"""Report the current local time.
|
||||
|
||||
Real local compute: reads the host clock and formats it in the host's local
|
||||
timezone. No external service and no configuration — the `compute` transport is
|
||||
the codebase's home for a body that acts on the machine itself.
|
||||
Real local compute: reads the host clock and formats it in the user's
|
||||
timezone — the top-level `timezone` config value (an IANA name such as
|
||||
`America/Chicago`) when set, otherwise the host's local timezone. No external
|
||||
service; the `compute` transport is the codebase's home for a body that acts on
|
||||
the machine itself.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -10,6 +12,7 @@ from __future__ import annotations
|
||||
from datetime import datetime
|
||||
|
||||
from semif_agent.skills import ActionResult
|
||||
from semif_agent.timers import local_now
|
||||
|
||||
INTEGRATION = {"service": "local_clock", "transport": "compute", "config_vars": []}
|
||||
|
||||
@@ -24,10 +27,10 @@ def _offset_text(now: datetime) -> str:
|
||||
|
||||
|
||||
def act(ctx, request):
|
||||
now = datetime.now().astimezone()
|
||||
now = local_now(ctx.config)
|
||||
zone = now.tzname() or "local"
|
||||
message = (
|
||||
f"It is {now.strftime('%H:%M')} "
|
||||
f"({now.strftime('%I:%M %p').lstrip('0')} {zone}{_offset_text(now)})."
|
||||
)
|
||||
return ActionResult(action_log=f"time.now: {message}", new_state=message)
|
||||
return ActionResult(action_log=message, new_state=message)
|
||||
@@ -1,8 +1,10 @@
|
||||
"""Set an alarm for a specific time of day that notifies when it goes off.
|
||||
|
||||
Real local compute: parses a wall-clock time out of the request and schedules it
|
||||
on the in-process timer service (`ctx.timers`). A time already past rolls to the
|
||||
next day. When it fires, the front end that set it notifies the user.
|
||||
on the in-process timer service (`ctx.timers`). The wall-clock time is read in
|
||||
the user's timezone — the top-level `timezone` config value when set, otherwise
|
||||
the host's local timezone. A time already past rolls to the next day. When it
|
||||
fires, the front end that set it notifies the user.
|
||||
|
||||
If no time can be parsed the body pauses and asks for one, stashing the answer
|
||||
in `request.meta` so the single-phase `act` re-run does not ask again.
|
||||
@@ -14,6 +16,7 @@ import re
|
||||
from datetime import datetime, time, timedelta
|
||||
|
||||
from semif_agent.skills import ActionResult
|
||||
from semif_agent.timers import local_now
|
||||
|
||||
INTEGRATION = {"service": "local_clock", "transport": "compute", "config_vars": []}
|
||||
|
||||
@@ -63,22 +66,22 @@ def act(ctx, request):
|
||||
request.meta.pop("alarm_awaiting", None)
|
||||
|
||||
text = request.meta.get("alarm_time_text") or request.text
|
||||
now = datetime.now().astimezone()
|
||||
now = local_now(ctx.config)
|
||||
when = _parse_time(text, now)
|
||||
if when is None:
|
||||
request.meta["alarm_awaiting"] = True
|
||||
return ActionResult(
|
||||
action_log="time.set_alarm: waiting for a time",
|
||||
action_log="waiting for a time",
|
||||
new_state=request.text,
|
||||
needs_input="What time should the alarm go off? (e.g. '5pm')",
|
||||
)
|
||||
if ctx.timers is None:
|
||||
return ActionResult(
|
||||
action_log="time.set_alarm: no timer service is available in this front end",
|
||||
action_log="no timer service is available in this front end",
|
||||
new_state=request.text,
|
||||
)
|
||||
|
||||
label = when.strftime("%H:%M")
|
||||
ctx.timers.set_alarm(when, label, run_id=request.id, source=request.source)
|
||||
message = f"Alarm set for {when.strftime('%H:%M')} on {when.strftime('%A')}."
|
||||
return ActionResult(action_log=f"time.set_alarm: {message}", new_state=message)
|
||||
return ActionResult(action_log=message, new_state=message)
|
||||
@@ -3,8 +3,9 @@
|
||||
Real local compute: parses a duration out of the request (digits or words) and
|
||||
schedules it on the in-process timer service (`ctx.timers`). When it fires, the
|
||||
front end that set it notifies the user — the REPL prints it, the gateway sends
|
||||
it back to the originating chat, the dashboard shows it. A timer lives in the
|
||||
process that set it and does not survive a restart.
|
||||
it back to the originating chat, the dashboard shows it. The due time is shown
|
||||
in the user's timezone (the top-level `timezone` config value, else host local).
|
||||
A timer lives in the process that set it and does not survive a restart.
|
||||
|
||||
If no duration can be parsed the body pauses and asks for one, stashing the
|
||||
answer in `request.meta` so the single-phase `act` re-run does not ask again.
|
||||
@@ -110,13 +111,13 @@ def act(ctx, request):
|
||||
if seconds is None:
|
||||
request.meta["timer_awaiting"] = True
|
||||
return ActionResult(
|
||||
action_log="time.set_timer: waiting for a duration",
|
||||
action_log="waiting for a duration",
|
||||
new_state=request.text,
|
||||
needs_input="How long should the timer run? (e.g. '5 minutes')",
|
||||
)
|
||||
if ctx.timers is None:
|
||||
return ActionResult(
|
||||
action_log="time.set_timer: no timer service is available in this front end",
|
||||
action_log="no timer service is available in this front end",
|
||||
new_state=request.text,
|
||||
)
|
||||
|
||||
@@ -124,4 +125,4 @@ def act(ctx, request):
|
||||
timer = ctx.timers.set_timer(seconds, label, run_id=request.id, source=request.source)
|
||||
due = timer.due_datetime().strftime("%H:%M")
|
||||
message = f"Timer set for {label}; it will fire at {due}."
|
||||
return ActionResult(action_log=f"time.set_timer: {message}", new_state=message)
|
||||
return ActionResult(action_log=message, new_state=message)
|
||||
+57
-24
@@ -29,7 +29,7 @@ from .console import (
|
||||
)
|
||||
from .decisions import DecisionRequest, Option
|
||||
from .engine import EngineConfig, EngineUnavailable, SemIfEngine
|
||||
from .llm import LLMClient
|
||||
from .llm import LLMClient, SemIfLLMClient
|
||||
from .log import DecisionLog
|
||||
from .scheduler import Scheduler
|
||||
from .skills import tree_summary
|
||||
@@ -177,6 +177,7 @@ def build_engine_config(config: dict, pins: dict | None = None) -> EngineConfig:
|
||||
gguf = _anchor_path(override) if override else str(
|
||||
REPO_ROOT / ".runtime" / "models" / os.path.basename(pin_eng.get("gguf_url", ""))
|
||||
)
|
||||
gpu_device = eng.get("gpu_device")
|
||||
return EngineConfig(
|
||||
backend=eng.get("backend", "llamacpp"),
|
||||
source=pin_eng.get("source", ""),
|
||||
@@ -184,6 +185,9 @@ def build_engine_config(config: dict, pins: dict | None = None) -> EngineConfig:
|
||||
gguf=gguf,
|
||||
context_tokens=int(eng.get("context_tokens", 4096)),
|
||||
threads=eng.get("threads"),
|
||||
gpu_layers=int(eng.get("gpu_layers", 0)),
|
||||
gpu_device=None if gpu_device is None else int(gpu_device),
|
||||
gpu_split=int(eng.get("gpu_split", 0)),
|
||||
)
|
||||
|
||||
|
||||
@@ -231,14 +235,28 @@ def build_codegen_client(config: dict) -> CodegenClient:
|
||||
)
|
||||
|
||||
|
||||
def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
|
||||
engine = SemIfEngine(build_engine_config(config))
|
||||
def build_llm_client(config: dict, engine):
|
||||
"""Build the `llm` title/description client from the `llm` config block.
|
||||
|
||||
`provider` selects the backend: `"semif"` drives the already-loaded SemIf
|
||||
engine model in-process (the GGUF is the model — no endpoint or `model` is
|
||||
needed), `"opencode"` the hosted Console client, and anything else the
|
||||
default ollama-compatible `LLMClient`. Shared by `build_scheduler` and tests
|
||||
so both exercise the configured provider rather than assuming ollama.
|
||||
"""
|
||||
llm_cfg = config.get("llm", {}) or {}
|
||||
llm_provider = str(llm_cfg.get("provider", "ollama") or "ollama").lower()
|
||||
llm_cls = ConsoleLLMClient if llm_provider == "opencode" else LLMClient
|
||||
llm_endpoint = _provider_endpoint(llm_cfg, "http://localhost:11434/v1")
|
||||
llm = llm_cls(
|
||||
base_url=llm_endpoint["base_url"],
|
||||
provider = str(llm_cfg.get("provider", "ollama") or "ollama").lower()
|
||||
if provider == "semif":
|
||||
semif_cfg = llm_cfg.get("semif", {}) or {}
|
||||
return SemIfLLMClient(
|
||||
engine,
|
||||
temperature=float(semif_cfg.get("temperature", 0.0)),
|
||||
max_tokens=int(semif_cfg.get("max_tokens", 256)),
|
||||
)
|
||||
llm_cls = ConsoleLLMClient if provider == "opencode" else LLMClient
|
||||
endpoint = _provider_endpoint(llm_cfg, "http://localhost:11434/v1")
|
||||
return llm_cls(
|
||||
base_url=endpoint["base_url"],
|
||||
model=_required_model(llm_cfg, "llm"),
|
||||
timeout=float(llm_cfg.get("timeout", 600.0)),
|
||||
stream=bool(llm_cfg.get("stream", False)),
|
||||
@@ -250,10 +268,15 @@ def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
|
||||
presence_penalty=_opt_float(llm_cfg.get("presence_penalty")),
|
||||
frequency_penalty=_opt_float(llm_cfg.get("frequency_penalty")),
|
||||
disable_thinking=bool(llm_cfg.get("disable_thinking", True)),
|
||||
api_key=llm_endpoint["api_key"],
|
||||
extra_headers=llm_endpoint["extra_headers"],
|
||||
user_agent=llm_endpoint["user_agent"],
|
||||
api_key=endpoint["api_key"],
|
||||
extra_headers=endpoint["extra_headers"],
|
||||
user_agent=endpoint["user_agent"],
|
||||
)
|
||||
|
||||
|
||||
def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
|
||||
engine = SemIfEngine(build_engine_config(config))
|
||||
llm = build_llm_client(config, engine)
|
||||
log = DecisionLog(config.get("log", "data/decisions.jsonl"))
|
||||
trace = TraceLog(config.get("trace", "data/runs.jsonl"))
|
||||
codegen_cfg = config.get("codegen", {})
|
||||
@@ -416,6 +439,18 @@ def _print_approvals(scheduler: Scheduler) -> None:
|
||||
print(f"[approval] {item['id']} new {item['kind']} {target}: {item['description']}")
|
||||
|
||||
|
||||
def _print_reply(reply, show_run_id: bool = False) -> None:
|
||||
"""Print a scheduler reply, optionally keeping its run id visible."""
|
||||
label = f"[{reply.run_id}] " if (show_run_id and reply.run_id) else ""
|
||||
print(f"[{reply.status}] {label}{reply.text}")
|
||||
|
||||
|
||||
def _drain_queue(scheduler: Scheduler) -> None:
|
||||
"""Run queued work, printing each outcome with its run id."""
|
||||
for reply in scheduler.run_queue():
|
||||
_print_reply(reply, show_run_id=True)
|
||||
|
||||
|
||||
def _fatal_exit(scheduler: Scheduler) -> int | None:
|
||||
"""If the scheduler hit a fatal engine failure, print it and return non-zero.
|
||||
|
||||
@@ -499,8 +534,7 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
print(f"[{status}] {detail}")
|
||||
_answer_questions(scheduler)
|
||||
_answer_approvals(scheduler)
|
||||
for result_status, result_detail in scheduler.run_queue():
|
||||
print(f"[{result_status}] {result_detail}")
|
||||
_drain_queue(scheduler)
|
||||
continue
|
||||
if lower.startswith("relabel "):
|
||||
parts = line.split()
|
||||
@@ -568,19 +602,16 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
scheduler.busy(line[5:].strip())
|
||||
print("current process set (busy).")
|
||||
continue
|
||||
status, detail = scheduler.submit(line)
|
||||
print(f"[{status}] {detail}")
|
||||
_print_reply(scheduler.submit(line))
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
while scheduler.pending is not None:
|
||||
hint = "" if scheduler.pending.pre_act else " [leave empty to skip]"
|
||||
answer = input(f"{scheduler.pending.question}{hint} ")
|
||||
status, detail = scheduler.answer(answer)
|
||||
print(f"[{status}] {detail}")
|
||||
_print_reply(scheduler.answer(answer))
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
for result_status, result_detail in scheduler.run_queue():
|
||||
print(f"[{result_status}] {result_detail}")
|
||||
_drain_queue(scheduler)
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
_answer_questions(scheduler)
|
||||
@@ -593,12 +624,12 @@ def scripted(scheduler: Scheduler, path: str) -> int:
|
||||
print(try_warm(scheduler))
|
||||
rows = [json.loads(line) for line in Path(path).read_text().splitlines() if line.strip()]
|
||||
for row in rows:
|
||||
status, detail = scheduler.submit(str(row["text"]), source=row.get("source", "scripted"))
|
||||
print(f"[{status}] {detail}")
|
||||
_print_reply(
|
||||
scheduler.submit(str(row["text"]), source=row.get("source", "scripted"))
|
||||
)
|
||||
if _fatal_exit(scheduler) is not None:
|
||||
return 1
|
||||
for result_status, result_detail in scheduler.run_queue():
|
||||
print(f"[{result_status}] {result_detail}")
|
||||
_drain_queue(scheduler)
|
||||
return _fatal_exit(scheduler) or 0
|
||||
|
||||
|
||||
@@ -718,7 +749,8 @@ def _resolve_platforms(requested: str, gateway_cfg: dict) -> list[str]:
|
||||
|
||||
`all`/`*` means every **enabled** gateway block in config; a
|
||||
comma-separated list is taken as-is (unknown names are kept so the caller
|
||||
can report them).
|
||||
can report them). Non-platform keys (`_comment`, the global `humanize`
|
||||
defaults block) are skipped.
|
||||
"""
|
||||
requested = (requested or "simplex").strip()
|
||||
if requested in ("all", "*"):
|
||||
@@ -727,6 +759,7 @@ def _resolve_platforms(requested: str, gateway_cfg: dict) -> list[str]:
|
||||
for name, block in (gateway_cfg or {}).items()
|
||||
if isinstance(block, dict)
|
||||
and not name.startswith("_")
|
||||
and name != "humanize"
|
||||
and block.get("enabled", False)
|
||||
]
|
||||
return [name.strip() for name in requested.split(",") if name.strip()]
|
||||
|
||||
@@ -111,8 +111,8 @@ def build_status(scheduler: Scheduler) -> dict:
|
||||
else None
|
||||
)
|
||||
queue = [
|
||||
{"id": request.id, "weight": weight, "text": request.text[:80]}
|
||||
for weight, request in scheduler.queue.items()
|
||||
{"id": request.id, "text": request.text[:80]}
|
||||
for request in scheduler.queue.items()
|
||||
]
|
||||
tau = scheduler.tau
|
||||
queue_max = scheduler.queue.max_size
|
||||
@@ -255,13 +255,13 @@ class DashboardHandler(BaseHTTPRequestHandler):
|
||||
with self.lock:
|
||||
try:
|
||||
body = self._read_json()
|
||||
status, detail, request_id = self.scheduler.submit_request(
|
||||
reply = self.scheduler.submit_request(
|
||||
str(body.get("text", "")), source=str(body.get("source", "dashboard"))
|
||||
)
|
||||
except Exception as exc:
|
||||
self._send_error(500, str(exc))
|
||||
return
|
||||
self._send(200, {"status": status, "detail": detail, "request_id": request_id})
|
||||
self._send(200, {"status": reply.status, "detail": reply.text, "request_id": reply.run_id})
|
||||
return
|
||||
if path == "/api/relabel":
|
||||
with self.lock:
|
||||
@@ -277,11 +277,11 @@ class DashboardHandler(BaseHTTPRequestHandler):
|
||||
with self.lock:
|
||||
try:
|
||||
body = self._read_json()
|
||||
status, detail = self.scheduler.answer(str(body.get("text", "")))
|
||||
reply = self.scheduler.answer(str(body.get("text", "")))
|
||||
except Exception as exc:
|
||||
self._send_error(500, str(exc))
|
||||
return
|
||||
self._send(200, {"status": status, "detail": detail})
|
||||
self._send(200, {"status": reply.status, "detail": reply.text})
|
||||
return
|
||||
if path == "/api/restart":
|
||||
with self.lock:
|
||||
|
||||
+142
-4
@@ -2,10 +2,11 @@
|
||||
|
||||
Wraps the SemIf package (`semif_phase1`). The import and model load happen
|
||||
lazily so the rest of the agent is pure stdlib and testable without SemIf
|
||||
installed. On hardware that is neither CUDA nor Apple, use the shipped
|
||||
llama.cpp backend: a local GGUF scored on CPU (or Vulkan if your llama.cpp
|
||||
build enables it). This engine is only usable on a machine with SemIf and the
|
||||
pinned GGUF available; elsewhere calls raise EngineUnavailable.
|
||||
installed. The shipped llama.cpp backend scores a local GGUF; it runs on CPU by
|
||||
default, and `EngineConfig.gpu_layers` offloads to a GPU when llama-cpp-python
|
||||
was built with a GPU backend (Vulkan/ROCm/CUDA). This engine is only usable on a
|
||||
machine with SemIf and the pinned GGUF available; elsewhere calls raise
|
||||
EngineUnavailable.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -29,6 +30,67 @@ class EngineConfig:
|
||||
gguf: str = ""
|
||||
context_tokens: int = 4096
|
||||
threads: int | None = None
|
||||
# GPU offload (llama.cpp). 0 keeps the CPU-only default; a positive count
|
||||
# offloads that many layers, -1 offloads all of them. Requires a
|
||||
# llama-cpp-python built with a GPU backend (Vulkan/ROCm/CUDA).
|
||||
gpu_layers: int = 0
|
||||
gpu_device: int | None = None
|
||||
gpu_split: int = 0
|
||||
|
||||
|
||||
def _require_gpu_offload() -> None:
|
||||
"""Fail loudly when GPU layers are requested but the build cannot offload."""
|
||||
import llama_cpp
|
||||
|
||||
if not llama_cpp.llama_supports_gpu_offload():
|
||||
raise EngineUnavailable(
|
||||
"engine.gpu_layers is set but this llama-cpp-python build has no GPU "
|
||||
"backend. Rebuild it with one, e.g. "
|
||||
"CMAKE_ARGS='-DGGML_VULKAN=on' (Vulkan), '-DGGML_HIP=on' (ROCm) or "
|
||||
"'-DGGML_CUDA=on' (CUDA)."
|
||||
)
|
||||
|
||||
|
||||
def _install_gpu_state_reset(model) -> None:
|
||||
"""Force a full cache reset between scored prompts when running on the GPU.
|
||||
|
||||
SemIf's `_Engine.clear` calls `llama_memory_clear(memory, False)`: it resets
|
||||
the cache metadata but leaves the stored data. The CPU backend tolerates that
|
||||
(the slots are overwritten before use), but the Vulkan backend keeps stale
|
||||
hybrid-attention/recurrent state, so repeated `score` calls drift and return
|
||||
wrong probabilities. Clearing the data as well restores determinism and
|
||||
matches the CPU path. Applied only when offloading, so CPU behaviour is
|
||||
untouched.
|
||||
"""
|
||||
engine = model.engine
|
||||
library = engine.lib
|
||||
|
||||
def clear():
|
||||
library.llama_memory_clear(engine.memory, True)
|
||||
|
||||
engine.clear = clear
|
||||
|
||||
|
||||
def _offloading_params(original, config: EngineConfig):
|
||||
"""Wrap SemIf's CPU-only model-params factory to offload layers to the GPU.
|
||||
|
||||
`semif_phase1.llamacpp_backend` is CPU-only by construction: its
|
||||
`_cpu_model_params` hardcodes `n_gpu_layers = 0`. The backend looks that name
|
||||
up on its own module while loading, so wrapping it for the duration of the
|
||||
load lets the same path offload without patching (and losing) the re-cloned
|
||||
engine source. The caller restores the original afterwards, so a CPU engine
|
||||
loaded later in the same process is unaffected.
|
||||
"""
|
||||
|
||||
def offloading(library):
|
||||
params = original(library)
|
||||
params.n_gpu_layers = config.gpu_layers
|
||||
params.split_mode = config.gpu_split
|
||||
if config.gpu_device is not None:
|
||||
params.main_gpu = config.gpu_device
|
||||
return params
|
||||
|
||||
return offloading
|
||||
|
||||
|
||||
class SemIfEngine:
|
||||
@@ -59,6 +121,11 @@ class SemIfEngine:
|
||||
"SemIf is not installed here. Install it on the target box with "
|
||||
"`pip install -e '.[test,llamacpp]'`."
|
||||
) from exc
|
||||
if self.config.gpu_layers:
|
||||
_require_gpu_offload()
|
||||
original_params = backend._cpu_model_params
|
||||
if self.config.gpu_layers:
|
||||
backend._cpu_model_params = _offloading_params(original_params, self.config)
|
||||
try:
|
||||
model, tokenizer, metadata = backend.load_model(
|
||||
self.config.source,
|
||||
@@ -69,6 +136,16 @@ class SemIfEngine:
|
||||
)
|
||||
except Exception as exc:
|
||||
raise EngineUnavailable(f"Failed to load the SemIf model: {exc}") from exc
|
||||
finally:
|
||||
backend._cpu_model_params = original_params
|
||||
if self.config.gpu_layers:
|
||||
_install_gpu_state_reset(model)
|
||||
# The backend hardcodes n_gpu_layers=0 in its metadata; record what we
|
||||
# actually asked llama.cpp to offload instead.
|
||||
metadata = dict(metadata)
|
||||
metadata["n_gpu_layers"] = self.config.gpu_layers
|
||||
if self.config.gpu_device is not None:
|
||||
metadata["main_gpu"] = self.config.gpu_device
|
||||
self._model, self._tokenizer, self._metadata = model, tokenizer, metadata
|
||||
return model, tokenizer, metadata
|
||||
|
||||
@@ -95,3 +172,64 @@ class SemIfEngine:
|
||||
},
|
||||
)
|
||||
|
||||
def generate(
|
||||
self,
|
||||
messages: list[dict],
|
||||
temperature: float = 0.0,
|
||||
max_tokens: int = 256,
|
||||
) -> str:
|
||||
"""Drive the pinned decision model in the normal way: text generation.
|
||||
|
||||
SemIf scoring reads option logits directly; this instead autoregressively
|
||||
samples from the same llama.cpp context, e.g. for skill-tree authoring.
|
||||
Generation decodes the chat template through the backend's low-level
|
||||
context (there is no high-level chat-completion object on the CPU
|
||||
backend), stopping at the tokenizer's eos token. The KV cache is cleared
|
||||
at the start, so interleaving scoring and generation on one model is safe.
|
||||
|
||||
It shares `self._lock` with `call`, so a generation serializes against
|
||||
decisions on the one loaded model — short JSON replies are seconds of
|
||||
contention, and there is only ever one copy of the GGUF.
|
||||
"""
|
||||
with self._lock:
|
||||
model, tokenizer, metadata = self._ensure_loaded()
|
||||
try:
|
||||
import numpy
|
||||
|
||||
engine = model.engine
|
||||
prompt_text = tokenizer.apply_chat_template(
|
||||
messages,
|
||||
tokenize=False,
|
||||
add_generation_prompt=True,
|
||||
enable_thinking=False,
|
||||
)
|
||||
prompt_ids = tokenizer.encode(prompt_text, add_special_tokens=False)
|
||||
engine.clear()
|
||||
logits = engine._decode(prompt_ids, 0, 0, True)
|
||||
generated: list[int] = []
|
||||
rng = numpy.random.default_rng()
|
||||
for position in range(max_tokens):
|
||||
token = _sample_token(logits, temperature, rng)
|
||||
if token == tokenizer.eos_token_id:
|
||||
break
|
||||
generated.append(token)
|
||||
logits = engine._decode([token], len(prompt_ids) + position, 0, True)
|
||||
return tokenizer.decode(generated).strip()
|
||||
except EngineUnavailable:
|
||||
raise
|
||||
except Exception as exc:
|
||||
raise EngineUnavailable(f"generation failed: {exc}") from exc
|
||||
|
||||
|
||||
def _sample_token(logits, temperature: float, rng) -> int:
|
||||
"""Pick the next token from next-position logits: greedy or temperature."""
|
||||
import numpy
|
||||
|
||||
if temperature <= 0.0:
|
||||
return int(numpy.argmax(logits))
|
||||
scaled = numpy.asarray(logits, dtype=numpy.float64) / max(temperature, 1e-6)
|
||||
scaled = scaled - scaled.max()
|
||||
probabilities = numpy.exp(scaled)
|
||||
probabilities /= probabilities.sum()
|
||||
return int(rng.choice(probabilities.size, p=probabilities))
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
"""Optional LLM cleanup of a skill's result line for the messenger gateway.
|
||||
|
||||
The scheduler's run summary is deterministic and technical — ``<skill>:
|
||||
<ok|failed> — <action_log>``, where the action log is whatever the skill body
|
||||
wrote (often mechanical: ``PUT 201 …``, ``sent via /_send to contact 12``).
|
||||
This layer rewrites only that result detail into one grounded, friendly
|
||||
sentence for a chat front end.
|
||||
|
||||
It is generation, never a decision: the success/failure verdict and the routing
|
||||
are already settled by SemIf and the runner, and the rewrite is never fed back
|
||||
into assessment, tracing, or the decision log. The prompt forbids adding,
|
||||
inferring, or dropping facts, and `humanize` falls back to the original text on
|
||||
any error, timeout, empty reply, refusal, or runaway length — a cleanup failure
|
||||
must never swallow or corrupt a real result.
|
||||
|
||||
It reuses the scheduler's configured ``llm`` client (its endpoint/model/sampler)
|
||||
and passes a short per-call ``timeout`` so a slow cleanup cannot hold the
|
||||
gateway's poll loop for the client's full authoring budget. It is deliberately
|
||||
gateway-only: the runner and the REPL keep the raw, deterministic summary.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
#: The strict rephrasing instruction. Grounding is enforced by the prompt and
|
||||
#: by the caller's fallback, not by a second model call.
|
||||
SYSTEM_PROMPT = (
|
||||
"You rewrite an assistant's raw action result into one short, friendly "
|
||||
"sentence for a chat reply.\n"
|
||||
"Rules:\n"
|
||||
"- Use ONLY the facts in the result. Do not add, guess, or infer anything.\n"
|
||||
"- Preserve whether the action succeeded or failed exactly as stated.\n"
|
||||
"- Do not mention servers, HTTP status codes, command names, file paths, "
|
||||
"or internal bookkeeping unless that is the only content.\n"
|
||||
"- One sentence. No preamble, no explanation, no quotes, no markdown.\n"
|
||||
"- If the result is already a plain sentence, return it unchanged."
|
||||
)
|
||||
|
||||
#: Leading phrases that mark a meta/refusal reply rather than a rewrite.
|
||||
_REFUSAL_PREFIXES = (
|
||||
"i cannot",
|
||||
"i can't",
|
||||
"i'm sorry",
|
||||
"i am sorry",
|
||||
"i'm unable",
|
||||
"i am unable",
|
||||
"as an ai",
|
||||
"sorry,",
|
||||
)
|
||||
|
||||
|
||||
def _clean_reply(raw: str) -> str:
|
||||
"""Normalize a model reply into one bare sentence, or "" if unusable."""
|
||||
text = (raw or "").strip()
|
||||
if not text:
|
||||
return ""
|
||||
# Drop a wrapping pair of quotes the model may add.
|
||||
if len(text) >= 2 and text[0] == text[-1] and text[0] in "\"'“”‘’":
|
||||
text = text[1:-1].strip()
|
||||
# Collapse newlines / runs of whitespace to a single line.
|
||||
return " ".join(text.split())
|
||||
|
||||
|
||||
class Humanizer:
|
||||
"""Rewrite a result line with an LLM, falling back to the source verbatim."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
client,
|
||||
*,
|
||||
enabled: bool = True,
|
||||
timeout: float = 20.0,
|
||||
max_tokens: int = 200,
|
||||
max_chars: int = 600,
|
||||
):
|
||||
self.client = client
|
||||
self.enabled = bool(enabled) and client is not None
|
||||
self.timeout = float(timeout)
|
||||
self.max_tokens = int(max_tokens)
|
||||
self.max_chars = int(max_chars)
|
||||
|
||||
def humanize(self, text: str) -> str:
|
||||
"""Return a grounded rewrite of `text`, or `text` unchanged.
|
||||
|
||||
Never raises: any failure (unreachable client, timeout, empty or
|
||||
unusable reply, refusal, runaway length) returns the original text.
|
||||
"""
|
||||
source = (text or "").strip()
|
||||
if not self.enabled or not source:
|
||||
return text
|
||||
messages = [
|
||||
{"role": "system", "content": SYSTEM_PROMPT},
|
||||
{"role": "user", "content": source},
|
||||
]
|
||||
try:
|
||||
raw = self.client.chat(
|
||||
messages, max_tokens=self.max_tokens, timeout=self.timeout
|
||||
)
|
||||
except Exception:
|
||||
return text
|
||||
cleaned = _clean_reply(raw)
|
||||
if not cleaned:
|
||||
return text
|
||||
if cleaned.lower().startswith(_REFUSAL_PREFIXES):
|
||||
return text
|
||||
if len(cleaned) > self.max_chars:
|
||||
return text
|
||||
return cleaned
|
||||
+133
-33
@@ -22,16 +22,16 @@ reaches the right chat.
|
||||
from __future__ import annotations
|
||||
|
||||
import queue
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
|
||||
from .base import InboundMessage, OutboundMessage
|
||||
|
||||
_LEADING_RUN_ID = re.compile(r"^\[[0-9a-f]{6,}\]\s*")
|
||||
from .humanize import Humanizer
|
||||
|
||||
#: The scheduler's run summary wraps the real result as
|
||||
#: `"<skill>: <ok|failed> — <detail>"`. A result-only platform (the voice
|
||||
#: gateway) speaks just `<detail>`.
|
||||
#: gateway) speaks just `<detail>`. Kept as a fallback for callers that hand
|
||||
#: `_reply` a raw summary; the scheduler itself passes the unwrapped `result`.
|
||||
_RESULT_SEP = " — "
|
||||
|
||||
_REPAIR_ACTIONS = {
|
||||
@@ -60,15 +60,6 @@ _APPROVAL_ACTIONS = {
|
||||
Target = tuple[str, str]
|
||||
|
||||
|
||||
def _strip_run_id(text: str) -> str:
|
||||
return _LEADING_RUN_ID.sub("", text or "")
|
||||
|
||||
|
||||
def _leading_run_id(text: str) -> str:
|
||||
match = _LEADING_RUN_ID.match(text or "")
|
||||
return match.group(0)[1:-2] if match else ""
|
||||
|
||||
|
||||
def _result_detail(text: str) -> str:
|
||||
"""Unwrap the scheduler's `"<skill>: <ok|failed> — <detail>"` summary.
|
||||
|
||||
@@ -82,7 +73,7 @@ def _result_detail(text: str) -> str:
|
||||
|
||||
def _reply_kind(status: str) -> str:
|
||||
"""Classify a scheduler outcome for a result-only front end."""
|
||||
if status in ("running", "preempted", "ran"):
|
||||
if status in ("running", "ran"):
|
||||
return "result"
|
||||
if status == "needs_input":
|
||||
return "question"
|
||||
@@ -112,6 +103,7 @@ class GatewayService:
|
||||
adapters,
|
||||
config: dict | None = None,
|
||||
poll_interval: float = 1.0,
|
||||
humanizer: Humanizer | None = None,
|
||||
):
|
||||
self.scheduler = scheduler
|
||||
self.adapters = _normalize_adapters(adapters)
|
||||
@@ -125,6 +117,17 @@ class GatewayService:
|
||||
self._platform_cfg: dict[str, dict] = {
|
||||
platform: self._config_for(platform) for platform in self.platforms
|
||||
}
|
||||
#: Optional LLM result cleanup (gateway-only presentation). Built from
|
||||
#: the scheduler's `llm` client unless one is injected; a no-op unless
|
||||
#: `gateway.humanize.enabled` (or a per-platform override) turns it on.
|
||||
if humanizer is not None:
|
||||
self.humanizer = humanizer
|
||||
self._humanize_default = bool(humanizer.enabled)
|
||||
else:
|
||||
humanize_cfg = self.config.get("humanize")
|
||||
humanize_cfg = humanize_cfg if isinstance(humanize_cfg, dict) else {}
|
||||
self._humanize_default = bool(humanize_cfg.get("enabled", False))
|
||||
self.humanizer = self._build_humanizer(humanize_cfg)
|
||||
self._owners: dict[str, Target] = {}
|
||||
self._parents: dict[str, str] = {}
|
||||
self._pending_owner: Target | None = None
|
||||
@@ -165,6 +168,71 @@ class GatewayService:
|
||||
return bool(cfg["result_only"])
|
||||
return bool(getattr(self.adapters.get(platform), "result_only", False))
|
||||
|
||||
# ---- optional LLM result cleanup ----
|
||||
|
||||
def _build_humanizer(self, cfg: dict) -> Humanizer | None:
|
||||
"""Build the result humanizer from config + the scheduler's `llm`.
|
||||
|
||||
Global defaults live in `gateway.humanize`; a per-platform
|
||||
`gateway.<platform>.humanize` (bool or `{enabled, timeout, max_tokens,
|
||||
max_chars}`) overrides the enable flag. Returns None when no `llm`
|
||||
client is available, so a client-less scheduler degrades to no cleanup.
|
||||
The instance is always built `enabled`; the global default is kept
|
||||
separately so a per-platform override can turn it on or off.
|
||||
"""
|
||||
client = getattr(self.scheduler, "llm", None)
|
||||
if client is None:
|
||||
return None
|
||||
return Humanizer(
|
||||
client,
|
||||
enabled=True,
|
||||
timeout=float(cfg.get("timeout", 20.0)),
|
||||
max_tokens=int(cfg.get("max_tokens", 200)),
|
||||
max_chars=int(cfg.get("max_chars", 600)),
|
||||
)
|
||||
|
||||
def _humanize_enabled(self, platform: str, skill_ref: str | None = None) -> bool:
|
||||
"""Whether this result is cleaned up.
|
||||
|
||||
Precedence: the **skill's own config** (`data/skills/<category>/<name>/
|
||||
config.json` -> `{"humanize": bool}`) wins; otherwise the per-platform
|
||||
override (`gateway.<platform>.humanize`), otherwise the global default
|
||||
(`gateway.humanize.enabled`). A missing `llm` client disables it.
|
||||
"""
|
||||
if self.humanizer is None:
|
||||
return False
|
||||
skill_override = self._skill_humanize_override(skill_ref)
|
||||
if skill_override is not None:
|
||||
return skill_override
|
||||
override = self._platform_cfg.get(platform, {}).get("humanize")
|
||||
if isinstance(override, bool):
|
||||
return override
|
||||
if isinstance(override, dict) and "enabled" in override:
|
||||
return bool(override["enabled"])
|
||||
return self._humanize_default
|
||||
|
||||
def _skill_humanize_override(self, skill_ref: str | None) -> bool | None:
|
||||
"""The skill's own `humanize` config value, or None when unset.
|
||||
|
||||
A skill opts in/out of result cleanup regardless of the platform default
|
||||
via its recorded config: `data/skills/<category>/<name>/config.json` ->
|
||||
`{"humanize": false}`. Read from the scheduler's skill store; a missing
|
||||
store/config/key (or an unparseable ref) means no override.
|
||||
"""
|
||||
if not skill_ref or "." not in skill_ref:
|
||||
return None
|
||||
store = getattr(self.scheduler, "body_store", None)
|
||||
if store is None:
|
||||
return None
|
||||
category, name = skill_ref.split(".", 1)
|
||||
try:
|
||||
config = store.read_config(category, name) or {}
|
||||
except Exception:
|
||||
return None
|
||||
if "humanize" in config:
|
||||
return bool(config["humanize"])
|
||||
return None
|
||||
|
||||
def _fallback_target(self) -> Target | None:
|
||||
for platform in self.platforms:
|
||||
home = self._home_channel(platform)
|
||||
@@ -219,10 +287,13 @@ class GatewayService:
|
||||
if pending is not None and pending.request.source == self.source_for(
|
||||
platform, msg.chat_id
|
||||
):
|
||||
status, detail = self.scheduler.answer(msg.text)
|
||||
reply = self.scheduler.answer(msg.text)
|
||||
if self.scheduler.pending is None:
|
||||
self._pending_owner = None
|
||||
self._reply(*reply_to, detail, kind=_reply_kind(status))
|
||||
self._reply(
|
||||
*reply_to, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
elif pending is not None and self._pending_owner not in (None, reply_to):
|
||||
self._reply(
|
||||
*reply_to,
|
||||
@@ -247,14 +318,17 @@ class GatewayService:
|
||||
self._surfaced.add(approval_id)
|
||||
self._reply(*reply_to, detail, kind="notice")
|
||||
else:
|
||||
status, detail, run_id = self.scheduler.submit_request(
|
||||
reply = self.scheduler.submit_request(
|
||||
msg.text, source=self.source_for(platform, msg.chat_id)
|
||||
)
|
||||
if run_id:
|
||||
self._owners[run_id] = reply_to
|
||||
if status == "needs_input":
|
||||
if reply.run_id:
|
||||
self._owners[reply.run_id] = reply_to
|
||||
if reply.status == "needs_input":
|
||||
self._pending_owner = reply_to
|
||||
self._reply(*reply_to, detail, kind=_reply_kind(status))
|
||||
self._reply(
|
||||
*reply_to, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
self.drain()
|
||||
self.surface(origin=reply_to)
|
||||
|
||||
@@ -264,15 +338,16 @@ class GatewayService:
|
||||
results = self.scheduler.run_queue()
|
||||
if not results:
|
||||
break
|
||||
for status, detail in results:
|
||||
run_id = _leading_run_id(detail)
|
||||
owner = self._owner_of(run_id)
|
||||
text = _strip_run_id(detail)
|
||||
if status == "needs_input" and owner:
|
||||
for reply in results:
|
||||
owner = self._owner_of(reply.run_id)
|
||||
if reply.status == "needs_input" and owner:
|
||||
self._pending_owner = owner
|
||||
target = owner or self._fallback_target()
|
||||
if target:
|
||||
self._reply(*target, text, kind=_reply_kind(status))
|
||||
self._reply(
|
||||
*target, reply.text, kind=_reply_kind(reply.status),
|
||||
skill_ref=reply.skill_ref, result=reply.result,
|
||||
)
|
||||
|
||||
def surface(self, origin: Target | None = None) -> None:
|
||||
"""Send any newly posted authoring questions / repair offers."""
|
||||
@@ -375,17 +450,41 @@ class GatewayService:
|
||||
|
||||
# ---- outbound ----
|
||||
|
||||
def _trace(self, kind: str, **fields) -> None:
|
||||
"""Best-effort trace (a test double's scheduler may have no trace log)."""
|
||||
trace = getattr(self.scheduler, "trace", None)
|
||||
if trace is not None:
|
||||
trace.append(kind, "?", **fields)
|
||||
|
||||
def _reply(
|
||||
self, platform: str, chat_id: str, text: str, kind: str = "reply"
|
||||
self,
|
||||
platform: str,
|
||||
chat_id: str,
|
||||
text: str,
|
||||
kind: str = "reply",
|
||||
skill_ref: str | None = None,
|
||||
result: str | None = None,
|
||||
) -> None:
|
||||
text = _strip_run_id(text)
|
||||
if self._result_only(platform):
|
||||
result_only = self._result_only(platform)
|
||||
humanize = kind == "result" and self._humanize_enabled(platform, skill_ref)
|
||||
if result_only:
|
||||
# A spoken front end says the skill's result, not the scheduler's
|
||||
# bookkeeping: drop queue/urgency chatter and unwrap the result line.
|
||||
# bookkeeping: drop queue/urgency chatter.
|
||||
if kind == "status":
|
||||
return
|
||||
if kind == "result":
|
||||
text = _result_detail(text)
|
||||
if kind == "result" and (result_only or humanize):
|
||||
# The scheduler hands us the skill's own unwrapped detail; fall back
|
||||
# to unwrapping `<skill>: <ok|failed> — <detail>` for raw-string
|
||||
# callers.
|
||||
text = result if result is not None else _result_detail(text)
|
||||
if humanize:
|
||||
started = time.time()
|
||||
text = self.humanizer.humanize(text)
|
||||
self._trace(
|
||||
"humanize",
|
||||
elapsed_s=round(time.time() - started, 3),
|
||||
chars=len(text),
|
||||
)
|
||||
prefix = str(self._platform_cfg.get(platform, {}).get("reply_prefix", "") or "")
|
||||
if prefix:
|
||||
text = f"{prefix}{text}"
|
||||
@@ -394,4 +493,5 @@ class GatewayService:
|
||||
target_queue = self.outbound.get(platform)
|
||||
if target_queue is None:
|
||||
return
|
||||
self._trace("gateway_reply_queued", reply_kind=kind, chars=len(text))
|
||||
target_queue.put(OutboundMessage(chat_id=str(chat_id), text=text))
|
||||
@@ -65,6 +65,7 @@ class VoiceAdapter(GatewayAdapter):
|
||||
if message is None:
|
||||
self.daemon.stop()
|
||||
return
|
||||
self.daemon._event("gateway_reply_dequeued", chars=len(message.text))
|
||||
self.daemon.speak(message.text)
|
||||
|
||||
threading.Thread(target=_pump, name="voice-outbound-pump", daemon=True).start()
|
||||
|
||||
+15
-1
@@ -13,7 +13,7 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from .provider import OpenAICompatClient, ProviderError
|
||||
from .provider import OpenAICompatClient, ProviderError, SemIfEngineClient
|
||||
|
||||
|
||||
class LLMError(ProviderError):
|
||||
@@ -102,3 +102,17 @@ class LLMClient(OpenAICompatClient):
|
||||
if start != -1 and end != -1:
|
||||
text = text[start : end + 1]
|
||||
return json.loads(text)
|
||||
|
||||
|
||||
class SemIfLLMClient(SemIfEngineClient):
|
||||
"""`llm` authoring backed by the loaded SemIf engine model.
|
||||
|
||||
The `llm.provider = "semif"` option: the same in-process GGUF the decision
|
||||
engine already loaded generates the title/description (and any other `llm`
|
||||
text) instead of calling an HTTP endpoint. Same `chat(...)` surface, same
|
||||
graceful error contract — raises `LLMError` so the scheduler traces a
|
||||
`draft_failed` and the LLM bridge reports 502 rather than crashing.
|
||||
"""
|
||||
|
||||
error_class = LLMError
|
||||
label = "semif:llm"
|
||||
@@ -42,6 +42,14 @@ class DecisionLog:
|
||||
}
|
||||
if extra:
|
||||
row["extra"] = extra
|
||||
result_extra = getattr(result, "extra", None) or {}
|
||||
timing = {
|
||||
key: result_extra[key]
|
||||
for key in ("input_tokens", "forward_seconds", "total_seconds")
|
||||
if key in result_extra
|
||||
}
|
||||
if timing:
|
||||
row.setdefault("extra", {})["timing"] = timing
|
||||
self.path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with self.path.open("a") as handle:
|
||||
handle.write(json.dumps(row) + "\n")
|
||||
|
||||
+92
-11
@@ -8,6 +8,11 @@ provider logic once; subclasses set `base_url`/`model`, their sampler
|
||||
parameters, and the error classes they raise so existing callers keep catching
|
||||
their own types.
|
||||
|
||||
It also holds `SemIfEngineClient`, the non-HTTP sibling that generates text
|
||||
from the in-process SemIf engine model (`engine.SemIfEngine.generate`) behind
|
||||
the same ``chat(...)`` surface, so the `llm` task can be served by the loaded
|
||||
decision model instead of an HTTP endpoint.
|
||||
|
||||
Stdlib-only and imports nothing from the agent's own modules, so `codegen.py`
|
||||
(which imports `skills.py`, which imports `llm.py`) can depend on it without a
|
||||
cycle.
|
||||
@@ -192,8 +197,13 @@ class OpenAICompatClient:
|
||||
top_p: float | None = None,
|
||||
presence_penalty: float | None = None,
|
||||
frequency_penalty: float | None = None,
|
||||
timeout: float | None = None,
|
||||
degeneration_check: Callable[[str], str | None] | None = None,
|
||||
) -> str:
|
||||
# A per-call `timeout` overrides the constructor value for this request
|
||||
# only (used by short auxiliary calls such as the gateway's result
|
||||
# cleanup, which must not inherit the authoring client's long budget).
|
||||
deadline = self.timeout if timeout is None else timeout
|
||||
budget = self._compute_budget(messages)
|
||||
if self.stream:
|
||||
self._print_budget(budget)
|
||||
@@ -227,15 +237,17 @@ class OpenAICompatClient:
|
||||
url, data=body, headers=self._headers()
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=self.timeout) as response:
|
||||
return self._read_stream(response, budget, degeneration_check)
|
||||
with urllib.request.urlopen(request, timeout=deadline) as response:
|
||||
return self._read_stream(
|
||||
response, budget, degeneration_check, timeout=deadline
|
||||
)
|
||||
except urllib.error.URLError as exc:
|
||||
raise self.error_class(
|
||||
f"{self.label} endpoint unreachable at {url}: {exc}. Is your local server running?"
|
||||
) from exc
|
||||
except TimeoutError as exc:
|
||||
raise self.error_class(
|
||||
f"{self.label} request timed out after {self.timeout}s at {url}"
|
||||
f"{self.label} request timed out after {deadline:.0f}s at {url}"
|
||||
) from exc
|
||||
|
||||
def _native_base_url(self) -> str:
|
||||
@@ -399,6 +411,7 @@ class OpenAICompatClient:
|
||||
response,
|
||||
budget: TokenBudget,
|
||||
degeneration_check: Callable[[str], str | None] | None = None,
|
||||
timeout: float | None = None,
|
||||
) -> str:
|
||||
"""Read an OpenAI-compatible SSE stream; echo tokens if `stream`.
|
||||
|
||||
@@ -426,7 +439,10 @@ class OpenAICompatClient:
|
||||
parts: list[str] = []
|
||||
sock = self._stream_socket(response)
|
||||
if sock is None:
|
||||
return self._read_stream_blocking(response, budget, degeneration_check)
|
||||
return self._read_stream_blocking(
|
||||
response, budget, degeneration_check, timeout=timeout
|
||||
)
|
||||
deadline = self.timeout if timeout is None else timeout
|
||||
start = time.monotonic()
|
||||
last_activity = start
|
||||
warned = False
|
||||
@@ -437,9 +453,9 @@ class OpenAICompatClient:
|
||||
recent_len = 0
|
||||
last_check: int | None = None
|
||||
while True:
|
||||
if time.monotonic() - start >= self.timeout:
|
||||
if time.monotonic() - start >= deadline:
|
||||
raise self.error_class(
|
||||
f"{self.label} request exceeded {self.timeout:.0f}s total budget"
|
||||
f"{self.label} request exceeded {deadline:.0f}s total budget"
|
||||
)
|
||||
ready, _, _ = select.select([sock], [], [], 1.0)
|
||||
now = time.monotonic()
|
||||
@@ -499,16 +515,18 @@ class OpenAICompatClient:
|
||||
response,
|
||||
budget: TokenBudget,
|
||||
degeneration_check: Callable[[str], str | None] | None = None,
|
||||
timeout: float | None = None,
|
||||
) -> str:
|
||||
"""Fallback reader when the response socket can't be located.
|
||||
|
||||
A plain blocking read relies on the per-read socket timeout for
|
||||
silence, but that bounds individual reads, not the whole stream — so
|
||||
enforce the same total wall-clock budget `self.timeout` and the token
|
||||
budget in the loop, or a continuously-streaming runaway would never be
|
||||
cut short.
|
||||
enforce the same total wall-clock budget (the per-call `timeout`, else
|
||||
`self.timeout`) and the token budget in the loop, or a
|
||||
continuously-streaming runaway would never be cut short.
|
||||
"""
|
||||
parts: list[str] = []
|
||||
deadline = self.timeout if timeout is None else timeout
|
||||
start = time.monotonic()
|
||||
warned_fill = False
|
||||
out_chars = 0
|
||||
@@ -517,9 +535,9 @@ class OpenAICompatClient:
|
||||
recent_len = 0
|
||||
last_check: int | None = None
|
||||
for raw in response:
|
||||
if time.monotonic() - start >= self.timeout:
|
||||
if time.monotonic() - start >= deadline:
|
||||
raise self.error_class(
|
||||
f"{self.label} request exceeded {self.timeout:.0f}s total budget"
|
||||
f"{self.label} request exceeded {deadline:.0f}s total budget"
|
||||
)
|
||||
continues, text, reasoning, frame_usage = self._consume_frame(
|
||||
raw.decode("utf-8").strip()
|
||||
@@ -620,3 +638,66 @@ class OpenAICompatClient:
|
||||
if sock is None:
|
||||
sock = getattr(response, "sock", None)
|
||||
return sock
|
||||
|
||||
|
||||
class SemIfEngineClient:
|
||||
"""Text generation backed by the in-process SemIf engine model.
|
||||
|
||||
A drop-in sibling of `OpenAICompatClient` for the small `llm` task: instead
|
||||
of speaking HTTP to an ollama/Console endpoint it drives the already-loaded
|
||||
decision GGUF through `engine.generate(...)`. It exposes the same
|
||||
``chat(messages, max_tokens=..., temperature=..., ...)`` surface every `llm`
|
||||
caller uses, so the provider choice is invisible to callers — title/
|
||||
description authoring, gateway result cleanup, and the LLM bridge all reuse
|
||||
it unchanged.
|
||||
|
||||
The engine is duck-typed (any object with ``generate(messages, temperature,
|
||||
max_tokens)``); this module stays free of imports from the agent's own
|
||||
modules, so subclasses in `llm.py` set the `LLMError` contract without a
|
||||
cycle. Sampler/`timeout`/`degeneration_check` arguments are accepted for
|
||||
signature compatibility and ignored: the engine generation is bounded by
|
||||
`max_tokens` and serializes on the engine's own lock.
|
||||
|
||||
Any engine failure (`EngineUnavailable`, a missing GGUF, a sampling error)
|
||||
is re-raised as `error_class` so the scheduler's graceful `draft_failed`
|
||||
path and the LLM bridge's 502 path keep their existing contracts.
|
||||
"""
|
||||
|
||||
error_class = ProviderError
|
||||
label = "semif"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
engine,
|
||||
temperature: float = 0.0,
|
||||
max_tokens: int = 256,
|
||||
disable_thinking: bool = True,
|
||||
):
|
||||
self.engine = engine
|
||||
self.temperature = temperature
|
||||
self.max_tokens = max_tokens
|
||||
# The engine's `generate` always decodes with thinking disabled; the knob
|
||||
# is accepted so the class mirrors the other providers' constructors.
|
||||
self.disable_thinking = disable_thinking
|
||||
|
||||
def chat(
|
||||
self,
|
||||
messages: list[dict],
|
||||
max_tokens: int | None = None,
|
||||
temperature: float | None = None,
|
||||
top_p: float | None = None,
|
||||
presence_penalty: float | None = None,
|
||||
frequency_penalty: float | None = None,
|
||||
timeout: float | None = None,
|
||||
degeneration_check: Callable[[str], str | None] | None = None,
|
||||
) -> str:
|
||||
resolved_max = self.max_tokens if max_tokens is None else max_tokens
|
||||
resolved_temp = self.temperature if temperature is None else temperature
|
||||
try:
|
||||
return self.engine.generate(
|
||||
messages, temperature=resolved_temp, max_tokens=resolved_max
|
||||
)
|
||||
except Exception as exc: # EngineUnavailable and anything the engine raises
|
||||
raise self.error_class(
|
||||
f"{self.label} generation failed: {exc}"
|
||||
) from exc
|
||||
+16
-55
@@ -1,83 +1,44 @@
|
||||
"""Urgency priority queue.
|
||||
"""FIFO request queue with a maximum depth.
|
||||
|
||||
Items are sorted by descending urgency weight, then FIFO arrival, then most
|
||||
recent first. Queued items age upward so they cannot starve, and the queue has
|
||||
a maximum depth.
|
||||
Requests are dispatched strictly in arrival order: there is no urgency scoring
|
||||
and no preemption, so the running process always finishes before the next queued
|
||||
request is picked up.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import heapq
|
||||
import itertools
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from collections import deque
|
||||
from typing import Iterator
|
||||
|
||||
from .decisions import Request
|
||||
|
||||
MIN_RECENCY = 0.0
|
||||
|
||||
class RequestQueue:
|
||||
"""A bounded first-in-first-out queue of pending requests."""
|
||||
|
||||
@dataclass
|
||||
class QueueItem:
|
||||
weight: float
|
||||
seq: int
|
||||
recency: float
|
||||
request: Request
|
||||
|
||||
def key(self) -> tuple:
|
||||
return (-self.weight, self.seq)
|
||||
|
||||
|
||||
class UrgencyQueue:
|
||||
"""A max-by-urgency priority queue with FIFO/recency tie-breaking."""
|
||||
|
||||
def __init__(self, max_size: int = 100, age_rate: float = 0.0):
|
||||
def __init__(self, max_size: int = 100):
|
||||
self.max_size = max_size
|
||||
self.age_rate = age_rate
|
||||
self._entries: list[tuple] = []
|
||||
self._counter = itertools.count()
|
||||
self._entries: deque[Request] = deque()
|
||||
|
||||
def push(self, request: Request, weight: float, recency: float | None = None) -> bool:
|
||||
"""Insert an item. Returns False if the queue is full."""
|
||||
def push(self, request: Request) -> bool:
|
||||
"""Append an item. Returns False if the queue is full."""
|
||||
if len(self._entries) >= self.max_size:
|
||||
return False
|
||||
item = QueueItem(
|
||||
weight=weight,
|
||||
seq=next(self._counter),
|
||||
recency=recency if recency is not None else time.time(),
|
||||
request=request,
|
||||
)
|
||||
entry = (*item.key(), next(self._counter), item)
|
||||
heapq.heappush(self._entries, entry)
|
||||
self._entries.append(request)
|
||||
return True
|
||||
|
||||
def pop(self) -> Request | None:
|
||||
if not self._entries:
|
||||
return None
|
||||
return heapq.heappop(self._entries)[-1].request
|
||||
return self._entries.popleft()
|
||||
|
||||
def peek(self) -> Request | None:
|
||||
if not self._entries:
|
||||
return None
|
||||
return self._entries[0][-1].request
|
||||
|
||||
def age(self, dt: float = 1.0) -> None:
|
||||
"""Pull queued priorities toward critical so old items catch up."""
|
||||
if self.age_rate <= 0:
|
||||
return
|
||||
rebuilt = []
|
||||
for entry in self._entries:
|
||||
item = entry[-1]
|
||||
item.weight += self.age_rate * dt * (1.0 - item.weight)
|
||||
rebuilt.append((*item.key(), next(self._counter), item))
|
||||
self._entries = rebuilt
|
||||
heapq.heapify(self._entries)
|
||||
return self._entries[0]
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self._entries)
|
||||
|
||||
def items(self) -> Iterator[tuple[float, Request]]:
|
||||
for entry in sorted(self._entries, key=lambda e: e[:-1]):
|
||||
item = entry[-1]
|
||||
yield item.weight, item.request
|
||||
def items(self) -> Iterator[Request]:
|
||||
yield from self._entries
|
||||
+128
-136
@@ -1,10 +1,11 @@
|
||||
"""The scheduler: choice, score, queue, dispatch.
|
||||
"""The scheduler: queue, dispatch.
|
||||
|
||||
Every SemIf decision (choice, score, navigation, sub-decision) is logged.
|
||||
A high-priority input can preempt the current process, which requeues with its
|
||||
state preserved; a deferred input is scored and queued by urgency. There is no
|
||||
up-front handle/ignore gate: every input is dispatched, and inputs that are not
|
||||
tasks fall through navigation into the closed `response` tree of canned replies.
|
||||
Every SemIf decision (navigation, sub-decision) is logged. Input that arrives
|
||||
while the single execution slot is busy waits in a strict FIFO queue and is
|
||||
dispatched in arrival order; there is no urgency scoring and no preemption.
|
||||
There is no up-front handle/ignore gate: every input is dispatched, and inputs
|
||||
that are not tasks fall through navigation into the closed `response` tree of
|
||||
canned replies.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -36,7 +37,7 @@ from .engine import EngineUnavailable, SemIfEngine
|
||||
from .llm import LLMClient
|
||||
from .log import DecisionLog
|
||||
from .provider import ProviderError
|
||||
from .queue import UrgencyQueue
|
||||
from .queue import RequestQueue
|
||||
from .skill import SkillRunner
|
||||
from .timers import TimerService
|
||||
from .skills import (
|
||||
@@ -68,21 +69,11 @@ from .skills import (
|
||||
)
|
||||
from .trace import TraceLog
|
||||
|
||||
CHOICE_INTERRUPT = "interrupt"
|
||||
URGENCY_OPTIONS = [
|
||||
("critical", "Immediate danger or critical failure."),
|
||||
("high", "Important but not dangerous."),
|
||||
("medium", "Should be handled reasonably soon."),
|
||||
("low", "Can wait."),
|
||||
]
|
||||
URGENCY_WEIGHTS = {"critical": 1.0, "high": 0.75, "medium": 0.5, "low": 0.25}
|
||||
|
||||
|
||||
@dataclass
|
||||
class Process:
|
||||
request: Request
|
||||
skill: str
|
||||
weight: float
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -107,7 +98,6 @@ class SkillWrite:
|
||||
request: Request
|
||||
category: str
|
||||
draft: SkillDraft
|
||||
weight: float
|
||||
repair_evidence: dict | None = None
|
||||
# Label for a corrective rewrite: "run_failure" (repair loop), "fidelity",
|
||||
# "test", or "manual" (a user-requested regen).
|
||||
@@ -127,7 +117,6 @@ class DraftAuthor:
|
||||
|
||||
request: Request
|
||||
category: str | None
|
||||
weight: float
|
||||
kind: str
|
||||
approved: bool = False
|
||||
|
||||
@@ -207,6 +196,29 @@ class DispatchResult:
|
||||
skill: str | None = None
|
||||
decisions_logged: int = 0
|
||||
needs_input: str | None = None
|
||||
#: `category.name` when a skill produced the outcome, else None. Carried
|
||||
#: structurally so front ends never parse it back out of `summary`.
|
||||
skill_ref: str | None = None
|
||||
#: The skill's own detail (its `action_log`, or `new_state` when empty) —
|
||||
#: the unwrapped result a `result_only` front end speaks.
|
||||
result: str | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class SchedulerReply:
|
||||
"""One scheduler outcome as a structured reply.
|
||||
|
||||
`text` is the human-facing summary (e.g. ``"time.now: ok — 12:00"``). The
|
||||
machine-readable fields a front end needs — the run id, the skill ref, and
|
||||
the skill's own unwrapped detail — ride alongside it instead of being
|
||||
parsed back out of `text`.
|
||||
"""
|
||||
|
||||
status: str
|
||||
text: str
|
||||
run_id: str = ""
|
||||
skill_ref: str | None = None
|
||||
result: str | None = None
|
||||
|
||||
|
||||
class Scheduler:
|
||||
@@ -236,6 +248,10 @@ class Scheduler:
|
||||
self.intent_tau = float(nav_cfg.get("intent_tau", 0.6))
|
||||
self.category_tau = float(nav_cfg.get("category_tau", 0.75))
|
||||
self.action_tau = float(nav_cfg.get("action_tau", 0.5))
|
||||
#: A softmax winner at or above this probability skips its confirm guard
|
||||
#: (scope/intent) — the winner is already decisive. Below it the guard
|
||||
#: runs and can reject into create.
|
||||
self.bypass_tau = float(nav_cfg.get("softmax_bypass_tau", 0.5))
|
||||
self.max_reentries = max_reentries
|
||||
self.codegen = codegen
|
||||
self.degeneration_check_factory = degeneration_check_factory
|
||||
@@ -262,9 +278,8 @@ class Scheduler:
|
||||
self.contract_search = bool(
|
||||
(codegen_cfg.get("contract_search", {}) or {}).get("enabled", True)
|
||||
)
|
||||
self.queue = UrgencyQueue(
|
||||
self.queue = RequestQueue(
|
||||
max_size=int(config.get("queue", {}).get("max_size", 100)),
|
||||
age_rate=float(config.get("queue", {}).get("age_rate", 0.0)),
|
||||
)
|
||||
self.skills = build_skills(config) + build_housekeeping_skills()
|
||||
self.tree = build_tree(self.skills)
|
||||
@@ -283,7 +298,7 @@ class Scheduler:
|
||||
merge_seed_store(self.tree, self.seed_store, self.body_store)
|
||||
merge_skill_store(self.tree, self.body_store, self.registry.read())
|
||||
apply_tombstones(self.tree, self.deleted)
|
||||
self.timers = TimerService(trace=self.trace)
|
||||
self.timers = TimerService(trace=self.trace, timezone=config.get("timezone"))
|
||||
self.ctx = ActionContext(
|
||||
engine=self.engine, config=config, timers=self.timers, admin=self
|
||||
)
|
||||
@@ -326,49 +341,14 @@ class Scheduler:
|
||||
self._fatal = f"decision engine not available: {exc}"
|
||||
return self._fatal
|
||||
|
||||
# ---- decision templates (all real SemIf, all logged) ----
|
||||
|
||||
def _interrupt_choice(self, request: Request, current: Process) -> bool:
|
||||
decision = DecisionRequest(
|
||||
state=f"{request.text} [current process: {current.skill}]",
|
||||
question="Should this be allowed to interrupt the current process?",
|
||||
options=[
|
||||
Option(CHOICE_INTERRUPT, "Yes, interrupt the current process."),
|
||||
Option("defer", "No, wait until the current process finishes."),
|
||||
],
|
||||
)
|
||||
result = self.engine.call(decision)
|
||||
self.log.append(
|
||||
decision,
|
||||
result,
|
||||
extra={"phase": "choice", "current": current.skill, "run_id": request.id},
|
||||
)
|
||||
return result.prob(CHOICE_INTERRUPT) >= self.tau
|
||||
|
||||
def _priority_score(self, request: Request, current: str | None = None) -> tuple[float, str]:
|
||||
decision = DecisionRequest(
|
||||
state=f"{request.text} [current process: {current}]",
|
||||
question="How urgent is this request?",
|
||||
options=[Option(option_id, description) for option_id, description in URGENCY_OPTIONS],
|
||||
)
|
||||
result = self.engine.call(decision)
|
||||
self.log.append(
|
||||
decision, result, extra={"phase": "score", "run_id": request.id}
|
||||
)
|
||||
label = result.selected
|
||||
return URGENCY_WEIGHTS[label], label
|
||||
|
||||
# ---- intake ----
|
||||
|
||||
def submit(self, text: str, source: str = "typed") -> tuple[str, str]:
|
||||
"""Feed one input. Returns (status, detail)."""
|
||||
status, detail, _ = self.submit_request(text, source)
|
||||
return status, detail
|
||||
def submit(self, text: str, source: str = "typed") -> SchedulerReply:
|
||||
"""Feed one input. Returns the structured reply."""
|
||||
return self.submit_request(text, source)
|
||||
|
||||
def submit_request(
|
||||
self, text: str, source: str = "typed"
|
||||
) -> tuple[str, str, str]:
|
||||
"""Feed one input, also returning the request id.
|
||||
def submit_request(self, text: str, source: str = "typed") -> SchedulerReply:
|
||||
"""Feed one input, returning the request id on the reply.
|
||||
|
||||
The id lets out-of-band interfaces (the messenger gateway) map a run
|
||||
back to the chat that originated it. The decision engine is real, so an
|
||||
@@ -377,61 +357,48 @@ class Scheduler:
|
||||
try:
|
||||
return self._submit(text, source)
|
||||
except EngineUnavailable as exc:
|
||||
return "fatal", self._mark_fatal(exc), ""
|
||||
return SchedulerReply("fatal", self._mark_fatal(exc))
|
||||
|
||||
def _submit(self, text: str, source: str = "typed") -> tuple[str, str, str]:
|
||||
def _submit(self, text: str, source: str = "typed") -> SchedulerReply:
|
||||
with self._lock:
|
||||
return self._submit_locked(text, source)
|
||||
|
||||
def _submit_locked(self, text: str, source: str = "typed") -> tuple[str, str, str]:
|
||||
def _submit_locked(self, text: str, source: str = "typed") -> SchedulerReply:
|
||||
request = Request(text, source=source)
|
||||
self.trace.append("submit", request.id, text=text, source=source)
|
||||
|
||||
if self.current is None:
|
||||
weight, label = self._priority_score(request)
|
||||
self.current = Process(request=request, skill="(scheduling)", weight=weight)
|
||||
self.current = Process(request=request, skill="(scheduling)")
|
||||
try:
|
||||
outcome = self._dispatch(request, weight=weight)
|
||||
outcome = self._dispatch(request)
|
||||
finally:
|
||||
if self.pending is None:
|
||||
self.current = None
|
||||
if outcome.kind == "needs_input":
|
||||
return "needs_input", outcome.summary, request.id
|
||||
return SchedulerReply(
|
||||
"needs_input", outcome.summary, request.id,
|
||||
outcome.skill_ref, outcome.result,
|
||||
)
|
||||
self.trace.append("ran", request.id, skill=outcome.skill, summary=outcome.summary)
|
||||
return "running", f"[{label}] {outcome.summary}", request.id
|
||||
return SchedulerReply(
|
||||
"running", outcome.summary, request.id,
|
||||
outcome.skill_ref, outcome.result,
|
||||
)
|
||||
|
||||
interrupt = self._interrupt_choice(request, self.current)
|
||||
if interrupt:
|
||||
if self.pending is not None:
|
||||
self.trace.append("pending_abandoned", self.pending.request.id)
|
||||
self.pending = None
|
||||
previous = self.current
|
||||
previous.request.resume["from_skill"] = previous.skill
|
||||
self.queue.push(previous.request, previous.weight)
|
||||
self.current = Process(request=request, skill="(scheduling)", weight=1.0)
|
||||
self.trace.append("preempted", request.id, preempted=previous.skill)
|
||||
outcome = self._dispatch(request, weight=1.0)
|
||||
if outcome.kind == "needs_input":
|
||||
return "preempted", f"interrupted {previous.skill}; {outcome.summary}", request.id
|
||||
self.current = None
|
||||
self.trace.append("ran", request.id, skill=outcome.skill, summary=outcome.summary)
|
||||
return "preempted", f"interrupted {previous.skill}; {outcome.summary}", request.id
|
||||
|
||||
weight, label = self._priority_score(request, current=self.current.skill)
|
||||
ok = self.queue.push(request, weight)
|
||||
ok = self.queue.push(request)
|
||||
if not ok:
|
||||
self.trace.append("rejected", request.id, reason="queue is full")
|
||||
return "rejected", "queue is full", request.id
|
||||
self.trace.append("queued", request.id, weight=weight, label=label)
|
||||
return "queued", f"urgency {label} (weight {weight:.2f})", request.id
|
||||
return SchedulerReply("rejected", "queue is full", request.id)
|
||||
self.trace.append("queued", request.id)
|
||||
return SchedulerReply("queued", "queued", request.id)
|
||||
|
||||
def busy(self, text: str, skill: str = "(driving)") -> None:
|
||||
"""Set a fake in-progress process so the choice/score path is exercised."""
|
||||
"""Set a fake in-progress process so the queue path is exercised."""
|
||||
with self._lock:
|
||||
if self.pending is not None:
|
||||
self.trace.append("pending_abandoned", self.pending.request.id)
|
||||
self.pending = None
|
||||
self.current = Process(request=Request(text, source="busy"), skill=skill, weight=1.0)
|
||||
self.current = Process(request=Request(text, source="busy"), skill=skill)
|
||||
|
||||
def idle(self) -> None:
|
||||
with self._lock:
|
||||
@@ -440,8 +407,8 @@ class Scheduler:
|
||||
self.pending = None
|
||||
self.current = None
|
||||
|
||||
def run_queue(self) -> list[tuple[str, str]]:
|
||||
"""Process the queue while idle. Returns the outcomes.
|
||||
def run_queue(self) -> list[SchedulerReply]:
|
||||
"""Process the queue while idle. Returns the structured outcomes.
|
||||
|
||||
Safe to call from any thread: guarded by the scheduler lock (RLock, so
|
||||
the async codegen worker can drain the queue from its completion path).
|
||||
@@ -449,19 +416,19 @@ class Scheduler:
|
||||
with self._lock:
|
||||
return self._run_queue_locked()
|
||||
|
||||
def _run_queue_locked(self) -> list[tuple[str, str]]:
|
||||
def _run_queue_locked(self) -> list[SchedulerReply]:
|
||||
results = []
|
||||
while self.current is None and len(self.queue) > 0:
|
||||
if self._fatal is not None:
|
||||
break
|
||||
request = self.queue.pop()
|
||||
self.trace.append("dequeued", request.id)
|
||||
self.current = Process(request=request, skill="(scheduling)", weight=0.0)
|
||||
self.current = Process(request=request, skill="(scheduling)")
|
||||
try:
|
||||
outcome = self._dispatch(request, weight=0.0)
|
||||
outcome = self._dispatch(request)
|
||||
except EngineUnavailable as exc:
|
||||
self._mark_fatal(exc)
|
||||
results.append(("fatal", self._fatal))
|
||||
results.append(SchedulerReply("fatal", self._fatal))
|
||||
break
|
||||
except Exception as exc:
|
||||
self.trace.append("error", request.id, phase="dispatch", message=str(exc))
|
||||
@@ -470,15 +437,29 @@ class Scheduler:
|
||||
if self.pending is None:
|
||||
self.current = None
|
||||
if outcome.kind == "needs_input":
|
||||
results.append(("needs_input", f"[{request.id}] {outcome.summary}"))
|
||||
results.append(
|
||||
SchedulerReply(
|
||||
"needs_input", outcome.summary, request.id,
|
||||
outcome.skill_ref, outcome.result,
|
||||
)
|
||||
)
|
||||
continue
|
||||
self.trace.append("ran", request.id, skill=outcome.skill, summary=outcome.summary)
|
||||
results.append(("ran", f"[{request.id}] {outcome.summary}"))
|
||||
results.append(
|
||||
SchedulerReply(
|
||||
"ran", outcome.summary, request.id,
|
||||
outcome.skill_ref, outcome.result,
|
||||
)
|
||||
)
|
||||
return results
|
||||
|
||||
# ---- dispatch ----
|
||||
|
||||
def _dispatch(self, request: Request, weight: float = 0.0) -> DispatchResult:
|
||||
def _dispatch(self, request: Request) -> DispatchResult:
|
||||
# Clear any confidence a prior dispatch left on the request (meta is
|
||||
# copied across a requeue); navigation sets it fresh when a leaf softmax
|
||||
# runs.
|
||||
request.meta.pop("leaf_softmax_prob", None)
|
||||
# Explicit housekeeping commands are deterministic: they route straight
|
||||
# to the meta skill, bypassing the generic guards (which misread a
|
||||
# task-like skill name as the task). Natural-language phrasings still go
|
||||
@@ -506,11 +487,12 @@ class Scheduler:
|
||||
self.tree,
|
||||
category_tau=self.category_tau,
|
||||
action_tau=self.action_tau,
|
||||
bypass_tau=self.bypass_tau,
|
||||
)
|
||||
if isinstance(navigation, CreateCategory):
|
||||
return self._dispatch_create_category(request, weight)
|
||||
return self._dispatch_create_category(request)
|
||||
if isinstance(navigation, CreateSkill):
|
||||
return self._dispatch_skill(request, navigation.category, weight)
|
||||
return self._dispatch_skill(request, navigation.category)
|
||||
if navigation.category in CANNED_CATEGORIES:
|
||||
return self._run_skill(navigation, request)
|
||||
if navigation.category in HARD_LOCKED_CATEGORIES:
|
||||
@@ -519,6 +501,17 @@ class Scheduler:
|
||||
# navigation's pick directly (the meta skill asks for any missing
|
||||
# target as an input variable).
|
||||
return self._run_skill(navigation, request)
|
||||
leaf_prob = request.meta.pop("leaf_softmax_prob", None)
|
||||
if leaf_prob is not None and leaf_prob >= self.bypass_tau:
|
||||
# A decisive leaf softmax winner skips the intent confirm.
|
||||
self.trace.append(
|
||||
"intent_bypass",
|
||||
request.id,
|
||||
category=navigation.category,
|
||||
skill=navigation.name,
|
||||
prob=leaf_prob,
|
||||
)
|
||||
return self._run_skill(navigation, request)
|
||||
if not confirm_skill_fit(
|
||||
self.engine, self.log, self.trace, request, navigation, self.intent_tau
|
||||
):
|
||||
@@ -530,12 +523,10 @@ class Scheduler:
|
||||
)
|
||||
if self._category_locked(navigation.category):
|
||||
return self._blocked_create(request, navigation.category)
|
||||
return self._dispatch_skill(request, navigation.category, weight)
|
||||
return self._dispatch_skill(request, navigation.category)
|
||||
return self._run_skill(navigation, request)
|
||||
|
||||
def _dispatch_create_category(
|
||||
self, request: Request, weight: float = 0.0
|
||||
) -> DispatchResult:
|
||||
def _dispatch_create_category(self, request: Request) -> DispatchResult:
|
||||
"""Queue a new top-level category for the `llm` draft worker.
|
||||
|
||||
The gate stays free: the small model authors the category in the
|
||||
@@ -543,7 +534,7 @@ class Scheduler:
|
||||
inside it and hands off to the codegen body worker. On failure the
|
||||
request is not re-dispatched and the user is told.
|
||||
"""
|
||||
self._queue_draft(request, None, "category", weight)
|
||||
self._queue_draft(request, None, "category")
|
||||
return DispatchResult(
|
||||
kind="create_category",
|
||||
summary=(
|
||||
@@ -553,7 +544,7 @@ class Scheduler:
|
||||
)
|
||||
|
||||
def _dispatch_skill(
|
||||
self, request: Request, category: str, weight: float = 0.0
|
||||
self, request: Request, category: str
|
||||
) -> DispatchResult:
|
||||
"""Queue a new skill leaf for the `llm` draft worker.
|
||||
|
||||
@@ -576,7 +567,7 @@ class Scheduler:
|
||||
),
|
||||
skill=name,
|
||||
)
|
||||
self._queue_draft(request, category, "skill", weight)
|
||||
self._queue_draft(request, category, "skill")
|
||||
return DispatchResult(
|
||||
kind="create_skill",
|
||||
summary=(
|
||||
@@ -640,7 +631,7 @@ class Scheduler:
|
||||
outcome = self.runner.run(skill, request)
|
||||
return self._finish_run(skill, request, outcome)
|
||||
|
||||
def answer(self, text: str) -> tuple[str, str]:
|
||||
def answer(self, text: str) -> SchedulerReply:
|
||||
"""Feed the human's answer to a run paused for input.
|
||||
|
||||
Routed directly to the pending run — no gate, score, or navigation —
|
||||
@@ -651,7 +642,7 @@ class Scheduler:
|
||||
"""
|
||||
with self._lock:
|
||||
if self.pending is None:
|
||||
return "error", "no run is waiting for input"
|
||||
return SchedulerReply("error", "no run is waiting for input")
|
||||
pending = self.pending
|
||||
self.pending = None
|
||||
pending.request.user_input = text
|
||||
@@ -666,10 +657,16 @@ class Scheduler:
|
||||
)
|
||||
result = self._finish_run(pending.skill, pending.request, outcome)
|
||||
if result.kind == "needs_input":
|
||||
return "needs_input", result.summary
|
||||
return SchedulerReply(
|
||||
"needs_input", result.summary, pending.request.id,
|
||||
result.skill_ref, result.result,
|
||||
)
|
||||
self.current = None
|
||||
self.trace.append("ran", pending.request.id, skill=result.skill, summary=result.summary)
|
||||
return "ran", f"[resumed] {result.summary}"
|
||||
return SchedulerReply(
|
||||
"ran", f"[resumed] {result.summary}", pending.request.id,
|
||||
result.skill_ref, result.result,
|
||||
)
|
||||
|
||||
def _finish_run(self, skill: Skill, request: Request, outcome) -> DispatchResult:
|
||||
if outcome.error:
|
||||
@@ -685,7 +682,7 @@ class Scheduler:
|
||||
question=outcome.needs_input,
|
||||
pre_act=outcome.pre_act,
|
||||
)
|
||||
self.current = Process(request=request, skill=skill.name, weight=0.5)
|
||||
self.current = Process(request=request, skill=skill.name)
|
||||
self.trace.append(
|
||||
"needs_input", request.id, skill=skill.name, question=outcome.needs_input
|
||||
)
|
||||
@@ -694,6 +691,8 @@ class Scheduler:
|
||||
summary=outcome.needs_input,
|
||||
skill=skill.name,
|
||||
needs_input=outcome.needs_input,
|
||||
skill_ref=f"{skill.category}.{skill.name}",
|
||||
result=outcome.action_log or outcome.new_state or None,
|
||||
)
|
||||
self.trace.append(
|
||||
"assessed",
|
||||
@@ -708,7 +707,7 @@ class Scheduler:
|
||||
requeued = False
|
||||
if outcome.updated_request and request.reentries < self.max_reentries:
|
||||
child = _requeue(request, outcome.updated_request)
|
||||
self.queue.push(child, 0.5)
|
||||
self.queue.push(child)
|
||||
self.trace.append("requeued", request.id, text=outcome.updated_request)
|
||||
if self.on_request_requeued is not None:
|
||||
self.on_request_requeued(request.id, child.id)
|
||||
@@ -717,12 +716,11 @@ class Scheduler:
|
||||
self._propose_repair(skill, request, outcome)
|
||||
return DispatchResult(
|
||||
kind="ran",
|
||||
summary=(
|
||||
f"{skill.name}: {'ok' if outcome.success else 'failed'} — "
|
||||
f"{outcome.action_log or outcome.summary}"
|
||||
),
|
||||
summary=outcome.summary,
|
||||
skill=skill.name,
|
||||
decisions_logged=outcome.decisions_logged,
|
||||
skill_ref=f"{skill.category}.{skill.name}",
|
||||
result=(outcome.action_log or outcome.new_state or None),
|
||||
)
|
||||
|
||||
# ---- repair loop ----
|
||||
@@ -950,7 +948,7 @@ class Scheduler:
|
||||
offer.status = "awaiting_user"
|
||||
if chosen == "retry":
|
||||
retry = Request(offer.request_text, source="repair_retry")
|
||||
self.queue.push(retry, 0.5)
|
||||
self.queue.push(retry)
|
||||
with self._lock:
|
||||
offer.status = "done"
|
||||
self.trace.append("repair_retry", offer.run_id, skill=offer.skill)
|
||||
@@ -1017,7 +1015,7 @@ class Scheduler:
|
||||
offer.status = "done"
|
||||
request = Request(offer.request_text, source="repair")
|
||||
self._start_skill_write(
|
||||
request, offer.category, draft, 0.5, repair_evidence=offer.evidence
|
||||
request, offer.category, draft, repair_evidence=offer.evidence
|
||||
)
|
||||
self.trace.append(
|
||||
"repair_executed",
|
||||
@@ -1046,7 +1044,6 @@ class Scheduler:
|
||||
request: Request,
|
||||
category: str | None,
|
||||
kind: str,
|
||||
weight: float,
|
||||
approved: bool = False,
|
||||
) -> None:
|
||||
"""Queue a category or skill draft for the `llm` worker.
|
||||
@@ -1061,7 +1058,6 @@ class Scheduler:
|
||||
DraftAuthor(
|
||||
request=request,
|
||||
category=category,
|
||||
weight=weight,
|
||||
kind=kind,
|
||||
approved=approved,
|
||||
)
|
||||
@@ -1135,7 +1131,7 @@ class Scheduler:
|
||||
category=draft.name,
|
||||
description=draft.description,
|
||||
)
|
||||
self._queue_draft(job.request, draft.name, "skill", job.weight, approved=True)
|
||||
self._queue_draft(job.request, draft.name, "skill", approved=True)
|
||||
|
||||
def _author_skill(self, job: DraftAuthor) -> None:
|
||||
"""Author a skill leaf stub, then launch the codegen body write.
|
||||
@@ -1192,7 +1188,7 @@ class Scheduler:
|
||||
)
|
||||
if self.codegen is None:
|
||||
return
|
||||
self._start_skill_write(job.request, job.category, draft, job.weight)
|
||||
self._start_skill_write(job.request, job.category, draft)
|
||||
|
||||
def _fail_draft(self, job: DraftAuthor, exc: Exception) -> None:
|
||||
"""Surface a failed draft authoring; the request is not re-dispatched."""
|
||||
@@ -1314,7 +1310,6 @@ class Scheduler:
|
||||
request: Request,
|
||||
category: str,
|
||||
draft: SkillDraft,
|
||||
weight: float,
|
||||
repair_evidence: dict | None = None,
|
||||
reason_kind: str = "run_failure",
|
||||
) -> None:
|
||||
@@ -1355,7 +1350,6 @@ class Scheduler:
|
||||
request=request,
|
||||
category=category,
|
||||
draft=draft,
|
||||
weight=weight,
|
||||
repair_evidence=repair_evidence,
|
||||
reason_kind=reason_kind,
|
||||
)
|
||||
@@ -1860,12 +1854,11 @@ class Scheduler:
|
||||
requeued = job.request.copy_for_requeue()
|
||||
requeued.meta["awaiting_skill_body"] = [job.category, job.draft.name]
|
||||
requeued.meta["parent_run"] = job.request.id
|
||||
self.queue.push(requeued, job.weight)
|
||||
self.queue.push(requeued)
|
||||
self.trace.append(
|
||||
"skill_requeued",
|
||||
job.request.id,
|
||||
text=requeued.text,
|
||||
weight=job.weight,
|
||||
)
|
||||
print(
|
||||
f"[codegen] body ready for {job.category}.{job.draft.name}; "
|
||||
@@ -1953,7 +1946,7 @@ class Scheduler:
|
||||
if request_text
|
||||
else Request(f"write the body for {category}.{name}: {draft.description}", source="restart")
|
||||
)
|
||||
self._start_skill_write(origin, category, draft, 0.5)
|
||||
self._start_skill_write(origin, category, draft)
|
||||
self.trace.append("skill_restarted", origin.id, category=category, skill=name)
|
||||
return "running", f"restarting body write for {category}.{name}"
|
||||
|
||||
@@ -2092,7 +2085,6 @@ class Scheduler:
|
||||
origin,
|
||||
category,
|
||||
draft,
|
||||
0.5,
|
||||
repair_evidence=evidence,
|
||||
reason_kind="manual",
|
||||
)
|
||||
@@ -2187,8 +2179,8 @@ class Scheduler:
|
||||
if offered:
|
||||
lines.append(f"repair offers: {len(offered)} (use `repairs`)")
|
||||
lines.append(f"queue: {len(self.queue)} pending")
|
||||
for weight, request in self.queue.items():
|
||||
lines.append(f" {request.id} w={weight:.2f} {request.text[:60]}")
|
||||
for request in self.queue.items():
|
||||
lines.append(f" {request.id} {request.text[:60]}")
|
||||
pending_timers = self.timers.pending()
|
||||
if pending_timers:
|
||||
lines.append(f"timers: {len(pending_timers)} scheduled")
|
||||
|
||||
+12
-2
@@ -310,8 +310,18 @@ class SkillRunner:
|
||||
),
|
||||
question="Did the skill achieve the user's goal?",
|
||||
options=[
|
||||
Option("success", "Yes — the goal was met."),
|
||||
Option("failure", "No — the goal was not met."),
|
||||
Option(
|
||||
"success",
|
||||
"Yes — the skill carried out the request and produced a "
|
||||
"truthful result. A definitive 'nothing found' or 'nothing "
|
||||
"to do' result (empty inbox, no unread messages, no "
|
||||
"matching event) counts as success.",
|
||||
),
|
||||
Option(
|
||||
"failure",
|
||||
"No — the request was not carried out, or the result is an "
|
||||
"error, a refusal, or an unresolved action.",
|
||||
),
|
||||
],
|
||||
)
|
||||
result = self.ctx.engine.call(outcome)
|
||||
|
||||
+49
-24
@@ -586,7 +586,7 @@ def _canned_response(name: str, message: str):
|
||||
"""An act that returns a fixed line. No transport, no generation, no config."""
|
||||
|
||||
def act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
return ActionResult(action_log=f"{name}: {message}", new_state=message)
|
||||
return ActionResult(action_log=message, new_state=message)
|
||||
|
||||
return act
|
||||
|
||||
@@ -799,7 +799,7 @@ def _resolve_target(admin, request: Request):
|
||||
names = ", ".join(f"{c}.{n}" for c, n in resolved)
|
||||
return ActionResult(
|
||||
action_log=(
|
||||
f"housekeeping: several skills match ({names}); "
|
||||
f"several skills match ({names}); "
|
||||
"name one as category.skill"
|
||||
),
|
||||
new_state="ambiguous",
|
||||
@@ -807,7 +807,7 @@ def _resolve_target(admin, request: Request):
|
||||
answer = (request.user_input or "").strip()
|
||||
if not answer:
|
||||
return ActionResult(
|
||||
action_log="housekeeping: awaiting skill name",
|
||||
action_log="awaiting skill name",
|
||||
new_state="awaiting target",
|
||||
needs_input=_TARGET_QUESTION,
|
||||
)
|
||||
@@ -819,11 +819,11 @@ def _resolve_target(admin, request: Request):
|
||||
if isinstance(ref, list):
|
||||
names = ", ".join(f"{c}.{n}" for c, n in ref)
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping: several skills match ({names}); be specific",
|
||||
action_log=f"several skills match ({names}); be specific",
|
||||
new_state="ambiguous",
|
||||
)
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping: no skill matches {answer!r}",
|
||||
action_log=f"no skill matches {answer!r}",
|
||||
new_state="not found",
|
||||
)
|
||||
|
||||
@@ -831,7 +831,7 @@ def _resolve_target(admin, request: Request):
|
||||
def _delete_skill_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
admin = ctx.admin
|
||||
if admin is None:
|
||||
return ActionResult("housekeeping.delete_skill: no admin available", "error")
|
||||
return ActionResult("no admin available", "error")
|
||||
target = _resolve_target(admin, request)
|
||||
if isinstance(target, ActionResult):
|
||||
return target
|
||||
@@ -840,35 +840,35 @@ def _delete_skill_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
if request.meta.get("housekeeping_confirm") != ref:
|
||||
request.meta["housekeeping_confirm"] = ref
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping.delete_skill: awaiting confirmation for {ref}",
|
||||
action_log=f"awaiting confirmation for {ref}",
|
||||
new_state="awaiting confirmation",
|
||||
needs_input=f"Delete {ref} and all its files? Reply yes to confirm.",
|
||||
)
|
||||
if not _confirmed(request):
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping.delete_skill: cancelled by user for {ref}",
|
||||
action_log=f"cancelled by user for {ref}",
|
||||
new_state="cancelled",
|
||||
)
|
||||
_status, detail = admin.delete_skill(category, name)
|
||||
return ActionResult(f"housekeeping.delete_skill: {detail}", detail)
|
||||
return ActionResult(detail, detail)
|
||||
|
||||
|
||||
def _clear_config_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
admin = ctx.admin
|
||||
if admin is None:
|
||||
return ActionResult("housekeeping.clear_config: no admin available", "error")
|
||||
return ActionResult("no admin available", "error")
|
||||
target = _resolve_target(admin, request)
|
||||
if isinstance(target, ActionResult):
|
||||
return target
|
||||
category, name = target
|
||||
_status, detail = admin.clear_skill_config(category, name)
|
||||
return ActionResult(f"housekeeping.clear_config: {detail}", detail)
|
||||
return ActionResult(detail, detail)
|
||||
|
||||
|
||||
def _regen_skill_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
admin = ctx.admin
|
||||
if admin is None:
|
||||
return ActionResult("housekeeping.regen_skill: no admin available", "error")
|
||||
return ActionResult("no admin available", "error")
|
||||
target = _resolve_target(admin, request)
|
||||
if isinstance(target, ActionResult):
|
||||
return target
|
||||
@@ -877,19 +877,19 @@ def _regen_skill_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
if request.meta.get("housekeeping_regen") != ref:
|
||||
request.meta["housekeeping_regen"] = ref
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping.regen_skill: awaiting guidance for {ref}",
|
||||
action_log=f"awaiting guidance for {ref}",
|
||||
new_state="awaiting guidance",
|
||||
needs_input="What needs to be fixed?",
|
||||
)
|
||||
guidance = (request.user_input or "").strip()
|
||||
_status, detail = admin.regen_skill(category, name, guidance)
|
||||
return ActionResult(f"housekeeping.regen_skill: {detail}", detail)
|
||||
return ActionResult(detail, detail)
|
||||
|
||||
|
||||
def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
admin = ctx.admin
|
||||
if admin is None:
|
||||
return ActionResult("housekeeping.cancel_build: no admin available", "error")
|
||||
return ActionResult("no admin available", "error")
|
||||
writing = [
|
||||
(category, skill.name)
|
||||
for category, skills in admin.tree.items()
|
||||
@@ -905,7 +905,7 @@ def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
names = ", ".join(f"{c}.{n}" for c, n in resolved)
|
||||
return ActionResult(
|
||||
action_log=(
|
||||
f"housekeeping.cancel_build: several skills match ({names}); "
|
||||
f"several skills match ({names}); "
|
||||
"name one as category.skill"
|
||||
),
|
||||
new_state="ambiguous",
|
||||
@@ -915,7 +915,7 @@ def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
category, name = resolved
|
||||
return ActionResult(
|
||||
action_log=(
|
||||
f"housekeeping.cancel_build: no build is in progress for "
|
||||
f"no build is in progress for "
|
||||
f"{category}.{name}"
|
||||
),
|
||||
new_state="no build",
|
||||
@@ -925,14 +925,14 @@ def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
category, name = writing[0]
|
||||
elif not writing:
|
||||
return ActionResult(
|
||||
action_log="housekeeping.cancel_build: no skill build is in progress",
|
||||
action_log="no skill build is in progress",
|
||||
new_state="no build",
|
||||
)
|
||||
else:
|
||||
answer = (request.user_input or "").strip()
|
||||
if not answer:
|
||||
return ActionResult(
|
||||
action_log="housekeeping.cancel_build: awaiting skill name",
|
||||
action_log="awaiting skill name",
|
||||
new_state="awaiting target",
|
||||
needs_input="Which skill build should I cancel? Reply with its name.",
|
||||
)
|
||||
@@ -943,7 +943,7 @@ def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
else:
|
||||
return ActionResult(
|
||||
action_log=(
|
||||
f"housekeeping.cancel_build: no build in progress matching "
|
||||
f"no build in progress matching "
|
||||
f"{answer!r}"
|
||||
),
|
||||
new_state="no build",
|
||||
@@ -953,7 +953,7 @@ def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
if request.meta.get("housekeeping_confirm") != ref:
|
||||
request.meta["housekeeping_confirm"] = ref
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping.cancel_build: awaiting confirmation for {ref}",
|
||||
action_log=f"awaiting confirmation for {ref}",
|
||||
new_state="awaiting confirmation",
|
||||
needs_input=(
|
||||
f"Cancel the build for {ref} and delete its half-built leaf? "
|
||||
@@ -962,11 +962,11 @@ def _cancel_build_act(ctx: ActionContext, request: Request) -> ActionResult:
|
||||
)
|
||||
if not _confirmed(request):
|
||||
return ActionResult(
|
||||
action_log=f"housekeeping.cancel_build: cancelled by user for {ref}",
|
||||
action_log=f"cancelled by user for {ref}",
|
||||
new_state="cancelled",
|
||||
)
|
||||
_status, detail = admin.cancel_skill_build(category, name)
|
||||
return ActionResult(f"housekeeping.cancel_build: {detail}", detail)
|
||||
return ActionResult(detail, detail)
|
||||
|
||||
|
||||
def build_housekeeping_skills() -> list[Skill]:
|
||||
@@ -1167,9 +1167,22 @@ def navigate(
|
||||
tree: dict[str, list[Skill]],
|
||||
category_tau: float = 0.75,
|
||||
action_tau: float = 0.5,
|
||||
bypass_tau: float = 0.5,
|
||||
) -> Skill | CreateCategory | CreateSkill:
|
||||
"""Descend the tree one SemIf choice per level. Every choice is logged.
|
||||
|
||||
**Confident softmax winners skip their confirm guard.** When the category
|
||||
softmax winner's probability is >= `bypass_tau` (default 0.5) the scope
|
||||
confirm (`confirm_category_fit`) is skipped — the winner is taken as-is
|
||||
(traced `category_scope_bypassed`); below it the guard runs and can reject
|
||||
the winner into create. The leaf softmax winner's probability is handed to
|
||||
dispatch (`request.meta["leaf_softmax_prob"]`) so `confirm_skill_fit` is
|
||||
likewise skipped above the threshold (traced `intent_bypass`). The guards
|
||||
exist to catch an unsure softmax; a winner at 0.5+ is already decisive, and
|
||||
each skipped guard is one fewer SemIf call on the hot path. Below the
|
||||
threshold the two-stage behavior is unchanged. The recorded data agrees:
|
||||
every logged winner >= 0.5 also passed its guard.
|
||||
|
||||
The **actionability guard** (`confirm_non_action`, phase
|
||||
`navigate:actionability`, keyed by `navigation.action_tau`) runs at the **top**
|
||||
of navigation, before any category is considered: the closed `response` tree
|
||||
@@ -1258,7 +1271,16 @@ def navigate(
|
||||
log.append(top, top_result, extra={"phase": "navigate:category", "run_id": request.id})
|
||||
category = top_result.selected
|
||||
if category != "create_category":
|
||||
if not confirm_category_fit(
|
||||
winner_prob = float(top_result.probs.get(category, 0.0))
|
||||
if winner_prob >= bypass_tau:
|
||||
# Confident winner: skip the scope confirm (one fewer SemIf call).
|
||||
trace.append(
|
||||
"category_scope_bypassed",
|
||||
request.id,
|
||||
category=category,
|
||||
prob=winner_prob,
|
||||
)
|
||||
elif not confirm_category_fit(
|
||||
engine, log, trace, request, category, descriptions.get(category, ""),
|
||||
category_tau,
|
||||
):
|
||||
@@ -1311,6 +1333,9 @@ def navigate(
|
||||
leaf_result = engine.call(leaf)
|
||||
log.append(leaf, leaf_result, extra={"phase": "navigate:leaf", "run_id": request.id})
|
||||
pick = leaf_result.selected
|
||||
# Hand the winner's confidence to dispatch so it can skip the intent guard
|
||||
# when the softmax is already decisive (see `navigate` docstring).
|
||||
request.meta["leaf_softmax_prob"] = float(leaf_result.probs.get(pick, 0.0))
|
||||
return next((s for s in skills if s.name == pick), skills[0])
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ function shortPhase(phase) {
|
||||
return phase.replace("navigate:", "nav:");
|
||||
}
|
||||
|
||||
const ALL_PHASES = ["gate", "choice", "score", "navigate:category", "navigate:leaf", "act"];
|
||||
const ALL_PHASES = ["navigate:category", "navigate:leaf", "act"];
|
||||
|
||||
function optionProbs(row) {
|
||||
return (row.options || []).map((o) => ({
|
||||
@@ -130,9 +130,7 @@ function eventRow(evt) {
|
||||
div.textContent = `assessed → ${evt.success ? "ok" : "fail"}`;
|
||||
div.title = evt.summary || "";
|
||||
} else if (evt.kind === "queued") {
|
||||
div.textContent = `queued (${evt.label})`;
|
||||
} else if (evt.kind === "preempted") {
|
||||
div.textContent = `preempted ${evt.preempted}`;
|
||||
div.textContent = "queued";
|
||||
} else if (evt.kind === "skill_writing") {
|
||||
div.textContent = `writing skill ${evt.skill} — ${evt.description} (${evt.model || "codegen"})`;
|
||||
if (evt.contract_ref) {
|
||||
@@ -420,9 +418,7 @@ function eventNode(evt) {
|
||||
node.appendChild(req);
|
||||
}
|
||||
} else if (evt.kind === "queued") {
|
||||
body.textContent = `urgency ${evt.label} (weight ${Number(evt.weight || 0).toFixed(2)})`;
|
||||
} else if (evt.kind === "preempted") {
|
||||
body.textContent = `interrupted ${evt.preempted}, requeued with state`;
|
||||
body.textContent = "queued";
|
||||
} else if (evt.kind === "dropped") {
|
||||
body.textContent = evt.reason || "";
|
||||
} else if (evt.kind === "skill_writing") {
|
||||
@@ -825,7 +821,7 @@ function renderStatus() {
|
||||
q.className = "muted";
|
||||
q.style.marginTop = "8px";
|
||||
q.textContent = state.status.queue
|
||||
.map((item) => `${item.id} w=${item.weight.toFixed(2)} ${item.text}`)
|
||||
.map((item) => `${item.id} ${item.text}`)
|
||||
.join("\n") || "queue empty";
|
||||
el.appendChild(q);
|
||||
|
||||
|
||||
@@ -183,8 +183,6 @@ select {
|
||||
}
|
||||
|
||||
.pill.gate { background: #2b3a52; color: #9ec1ff; }
|
||||
.pill.choice { background: #4a3a2b; color: #ffd59e; }
|
||||
.pill.score { background: #3a2b4a; color: #d59eff; }
|
||||
.pill.navigate { background: #2b4a3a; color: #9effd5; }
|
||||
.pill.act { background: #2b464a; color: #9eeaff; }
|
||||
.pill.assess { background: #4a2b2b; color: #ff9e9e; }
|
||||
|
||||
+38
-3
@@ -19,7 +19,31 @@ import threading
|
||||
import time
|
||||
import uuid
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
from datetime import datetime, tzinfo
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
|
||||
def resolve_timezone(config) -> tzinfo | None:
|
||||
"""The tzinfo named by `config["timezone"]`, or None for host local.
|
||||
|
||||
An empty/absent name or an unknown zone falls back to the host's local
|
||||
timezone (None), so a misconfigured value never breaks a run.
|
||||
"""
|
||||
name = str((config or {}).get("timezone", "") or "").strip()
|
||||
if not name:
|
||||
return None
|
||||
try:
|
||||
return ZoneInfo(name)
|
||||
except (ZoneInfoNotFoundError, ValueError, KeyError):
|
||||
return None
|
||||
|
||||
|
||||
def local_now(config=None) -> datetime:
|
||||
"""Current time, aware: the configured timezone, else the host's local zone."""
|
||||
tz = resolve_timezone(config)
|
||||
if tz is None:
|
||||
return datetime.now().astimezone()
|
||||
return datetime.now(tz)
|
||||
|
||||
|
||||
def format_duration(seconds: float) -> str:
|
||||
@@ -51,8 +75,12 @@ class Timer:
|
||||
source: str
|
||||
due_at: float # epoch seconds
|
||||
created_at: float = field(default_factory=time.time)
|
||||
# tzinfo used to format the due time for the user (None = host local).
|
||||
tz: tzinfo | None = None
|
||||
|
||||
def due_datetime(self) -> datetime:
|
||||
if self.tz is not None:
|
||||
return datetime.fromtimestamp(self.due_at, tz=self.tz)
|
||||
return datetime.fromtimestamp(self.due_at).astimezone()
|
||||
|
||||
def as_dict(self) -> dict:
|
||||
@@ -102,9 +130,10 @@ class TimerService:
|
||||
`fired()` keeps a bounded history for the dashboard.
|
||||
"""
|
||||
|
||||
def __init__(self, trace=None, history: int = 50):
|
||||
def __init__(self, trace=None, history: int = 50, timezone: str | None = None):
|
||||
self.trace = trace
|
||||
self._history_limit = int(history)
|
||||
self._tz = resolve_timezone({"timezone": timezone})
|
||||
self._lock = threading.RLock()
|
||||
self._cv = threading.Condition(self._lock)
|
||||
self._heap: list[tuple[float, int, Timer]] = []
|
||||
@@ -140,6 +169,7 @@ class TimerService:
|
||||
label=str(label or ""),
|
||||
source=str(source or ""),
|
||||
due_at=float(due_at),
|
||||
tz=self._tz,
|
||||
)
|
||||
with self._cv:
|
||||
self._seq += 1
|
||||
@@ -243,8 +273,13 @@ class TimerService:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _to_local(self, ts: float) -> datetime:
|
||||
if self._tz is not None:
|
||||
return datetime.fromtimestamp(ts, tz=self._tz)
|
||||
return datetime.fromtimestamp(ts).astimezone()
|
||||
|
||||
def _message(self, timer: Timer, fired_at: float) -> str:
|
||||
when = datetime.fromtimestamp(fired_at).astimezone().strftime("%H:%M")
|
||||
when = self._to_local(fired_at).strftime("%H:%M")
|
||||
if timer.kind == "alarm":
|
||||
body = timer.label or "Alarm"
|
||||
return f"Alarm: {body} — it's {when}."
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
scheduler.
|
||||
|
||||
Decision rows live in `decisions.jsonl` (SemIf-compatible). Lifecycle events
|
||||
(submit, dropped, queued, preempted, assessed, requeued, ...) live here in
|
||||
(submit, dropped, queued, dequeued, assessed, requeued, ...) live here in
|
||||
`runs.jsonl`, keyed by `run_id` (the request id) so the dashboard can rebuild
|
||||
each run's flow without touching the decision-log contract. Both files are
|
||||
append-only; replays read them in order.
|
||||
@@ -19,8 +19,10 @@ class TraceLog:
|
||||
def __init__(self, path: str = "data/runs.jsonl"):
|
||||
self.path = Path(path)
|
||||
|
||||
def append(self, kind: str, run_id: str, **fields) -> None:
|
||||
row = {"kind": kind, "run_id": run_id, "ts": time.time(), **fields}
|
||||
def append(self, kind: str, run_id: str, ts: float | None = None, **fields) -> None:
|
||||
# `ts` lets a caller record the moment an event *happened* (e.g. the last
|
||||
# speech frame of an utterance) rather than when the row was written.
|
||||
row = {"kind": kind, "run_id": run_id, "ts": time.time() if ts is None else ts, **fields}
|
||||
self.path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with self.path.open("a") as handle:
|
||||
handle.write(json.dumps(row) + "\n")
|
||||
|
||||
@@ -719,6 +719,9 @@ class VoiceDaemon:
|
||||
speech_ms = self.frame_ms
|
||||
silence_ms = 0
|
||||
started = time.time()
|
||||
#: Wall-clock of the most recent frame the VAD called speech — the
|
||||
#: "last word spoken" boundary the latency breakdown measures from.
|
||||
last_speech_ts = started
|
||||
while not self._stop.is_set():
|
||||
if self._speaking.is_set():
|
||||
break # a reply started; stop capturing so we don't transcribe it
|
||||
@@ -731,6 +734,7 @@ class VoiceDaemon:
|
||||
if engines.vad.is_speech(pcm, self.sample_rate):
|
||||
speech_ms += self.frame_ms
|
||||
silence_ms = 0
|
||||
last_speech_ts = time.time()
|
||||
else:
|
||||
silence_ms += self.frame_ms
|
||||
if silence_ms >= self.vad_silence_ms:
|
||||
@@ -743,6 +747,7 @@ class VoiceDaemon:
|
||||
silence_ms=silence_ms,
|
||||
)
|
||||
return b""
|
||||
self._event("voice_speech_end", ts=last_speech_ts, speech_ms=speech_ms)
|
||||
self._event("voice_utterance", frames=len(frames), speech_ms=speech_ms)
|
||||
return b"".join(frames)
|
||||
|
||||
@@ -776,11 +781,23 @@ class VoiceDaemon:
|
||||
text = (clipped or text[: self.max_speak_chars]) + "…"
|
||||
engines = self._ensure_engines()
|
||||
self._speaking.set()
|
||||
self._event("voice_speak_start", chars=len(text))
|
||||
try:
|
||||
synth_started = time.time()
|
||||
pcm, sample_rate = engines.tts.synthesize(text)
|
||||
self._event(
|
||||
"voice_tts_synth",
|
||||
synth_s=round(time.time() - synth_started, 3),
|
||||
chars=len(text),
|
||||
audio_s=round(len(pcm) / BYTES_PER_SAMPLE / sample_rate, 3)
|
||||
if pcm and sample_rate
|
||||
else 0.0,
|
||||
)
|
||||
if pcm:
|
||||
with self._audio_lock:
|
||||
engines.audio.open_output(sample_rate)
|
||||
# The instant the first reply audio is handed to the device.
|
||||
self._event("voice_playback_start", ts=time.time(), chars=len(text))
|
||||
engines.audio.write(pcm, sample_rate)
|
||||
self._event("voice_spoke", chars=len(text))
|
||||
except Exception as exc:
|
||||
@@ -800,6 +817,6 @@ class VoiceDaemon:
|
||||
|
||||
# ---- tracing ----
|
||||
|
||||
def _event(self, kind: str, **fields) -> None:
|
||||
def _event(self, kind: str, ts: float | None = None, **fields) -> None:
|
||||
if self.trace is not None:
|
||||
self.trace.append(kind, "?", **fields)
|
||||
self.trace.append(kind, "?", ts=ts, **fields)
|
||||
@@ -25,12 +25,15 @@ from semif_agent.codegen import (
|
||||
parse_contract,
|
||||
parse_integration,
|
||||
)
|
||||
from semif_agent.decisions import Request
|
||||
from semif_agent.decisions import DecisionRequest, Option, Request
|
||||
from semif_agent.dream import dream
|
||||
from semif_agent.engine import EngineUnavailable
|
||||
from semif_agent.engine import EngineUnavailable, SemIfEngine
|
||||
from semif_agent.log import DecisionLog
|
||||
from semif_agent.scheduler import SkillWrite
|
||||
from semif_agent.skill import SkillRunner
|
||||
from semif_agent.skills import (
|
||||
ActionResult,
|
||||
ActionContext,
|
||||
CategoryDraft,
|
||||
CreateCategory,
|
||||
Skill,
|
||||
@@ -94,6 +97,55 @@ def _install_tracking_fixture(scheduler):
|
||||
]
|
||||
|
||||
|
||||
def test_engine_gpu_offload_is_deterministic_and_matches_cpu(tmp_path):
|
||||
"""With a GPU-backed llama-cpp-python and `engine.gpu_layers` set, offload
|
||||
must be deterministic across repeated calls and match the CPU path.
|
||||
|
||||
Regression: SemIf's `_Engine.clear` resets only cache metadata
|
||||
(`llama_memory_clear(mem, False)`). The CPU backend tolerates that, but the
|
||||
Vulkan backend keeps stale hybrid-attention state, so successive `score`
|
||||
calls drifted (0.08 -> 0.36 -> 0.43). The wrapper clears the data too. This
|
||||
is the honest correctness check: "it loaded" is not enough on Qwen3.5's
|
||||
hybrid architecture.
|
||||
"""
|
||||
import llama_cpp
|
||||
|
||||
config = load_config()
|
||||
require_real(config)
|
||||
if not llama_cpp.llama_supports_gpu_offload():
|
||||
pytest.skip("llama-cpp-python has no GPU backend")
|
||||
base = build_engine_config(config)
|
||||
if not base.gpu_layers:
|
||||
pytest.skip("engine.gpu_layers is 0 (CPU-only); set it to exercise offload")
|
||||
|
||||
from dataclasses import replace
|
||||
|
||||
request = DecisionRequest(
|
||||
state=(
|
||||
"The user said: 'check the weather in Paris tomorrow and tell me if "
|
||||
"I need an umbrella'."
|
||||
),
|
||||
question="Is this input an actionable request, or non-action chatter?",
|
||||
options=[
|
||||
Option(id="action", description="An actionable request to perform a task."),
|
||||
Option(
|
||||
id="non_action",
|
||||
description="Chit-chat, a statement, or too vague to act on.",
|
||||
),
|
||||
],
|
||||
)
|
||||
cpu = SemIfEngine(replace(base, gpu_layers=0)).call(request).probabilities
|
||||
gpu_engine = SemIfEngine(base)
|
||||
runs = [gpu_engine.call(request).probabilities for _ in range(3)]
|
||||
print(f"cpu={cpu} gpu={runs}")
|
||||
for run in runs[1:]:
|
||||
assert max(abs(a - b) for a, b in zip(runs[0], run)) < 1e-5, (
|
||||
"GPU offload must be deterministic across repeated calls"
|
||||
)
|
||||
diff = max(abs(a - b) for a, b in zip(cpu, runs[0]))
|
||||
assert diff < 2e-3, f"GPU offload changed the option probabilities by {diff}"
|
||||
|
||||
|
||||
def test_pipeline_end_to_end(tmp_path):
|
||||
config = load_config()
|
||||
require_real(config)
|
||||
@@ -106,9 +158,9 @@ def test_pipeline_end_to_end(tmp_path):
|
||||
"what is the delivery status of my parcel",
|
||||
]
|
||||
for text in inputs:
|
||||
status, detail = scheduler.submit(text)
|
||||
print(f"[{status}] {detail}")
|
||||
assert status in ("running", "preempted", "queued", "rejected")
|
||||
reply = scheduler.submit(text)
|
||||
print(f"[{reply.status}] {reply.text}")
|
||||
assert reply.status in ("running", "queued", "rejected")
|
||||
|
||||
scheduler.run_queue()
|
||||
|
||||
@@ -260,7 +312,7 @@ def test_navigate_routes_unmatched_action_to_create_skill(tmp_path):
|
||||
),
|
||||
]
|
||||
queued: list = []
|
||||
scheduler._queue_draft = lambda request, category, kind, weight: queued.append(
|
||||
scheduler._queue_draft = lambda request, category, kind: queued.append(
|
||||
(category, kind)
|
||||
)
|
||||
|
||||
@@ -284,7 +336,7 @@ def test_navigate_routes_unmatched_action_to_create_skill(tmp_path):
|
||||
assert read.skill == "next_message"
|
||||
|
||||
|
||||
def test_busy_choice_path(tmp_path):
|
||||
def test_busy_queue_path(tmp_path):
|
||||
config = load_config()
|
||||
require_real(config)
|
||||
_isolate_runtime(config, tmp_path)
|
||||
@@ -292,9 +344,9 @@ def test_busy_choice_path(tmp_path):
|
||||
_install_tracking_fixture(scheduler)
|
||||
|
||||
scheduler.busy("driving on the freeway", skill="driving")
|
||||
status, detail = scheduler.submit("tell me if my package was delivered")
|
||||
print(f"[{status}] {detail}")
|
||||
assert status in ("preempted", "queued")
|
||||
reply = scheduler.submit("tell me if my package was delivered")
|
||||
print(f"[{reply.status}] {reply.text}")
|
||||
assert reply.status == "queued"
|
||||
scheduler.idle()
|
||||
|
||||
|
||||
@@ -439,7 +491,6 @@ def test_fidelity_gate_is_a_real_semif_decision(tmp_path):
|
||||
draft=SkillDraft(
|
||||
name="track_delivery", description="Check a package's delivery status."
|
||||
),
|
||||
weight=0.5,
|
||||
)
|
||||
undeclared = '''\
|
||||
from semif_agent.skills import ActionResult
|
||||
@@ -497,13 +548,13 @@ def test_create_skill_empty_category_does_not_wedge(tmp_path):
|
||||
scheduler.tree["travel_planning"] = []
|
||||
|
||||
for _ in range(2):
|
||||
status, detail = scheduler.submit("look up flights to japan for february")
|
||||
print(f"[{status}] {detail}")
|
||||
assert status in ("running", "preempted", "queued", "rejected", "error")
|
||||
reply = scheduler.submit("look up flights to japan for february")
|
||||
print(f"[{reply.status}] {reply.text}")
|
||||
assert reply.status in ("running", "queued", "rejected", "error")
|
||||
assert scheduler.current is None, "scheduler must never stay wedged after a submit"
|
||||
|
||||
status, detail = scheduler.submit("tell me if my package was delivered")
|
||||
print(f"[{status}] {detail}")
|
||||
reply = scheduler.submit("tell me if my package was delivered")
|
||||
print(f"[{reply.status}] {reply.text}")
|
||||
assert scheduler.current is None
|
||||
|
||||
|
||||
@@ -531,10 +582,10 @@ def test_create_simplex_send_skill(tmp_path):
|
||||
f"the simplex seeds must be loaded, got {seeded}"
|
||||
)
|
||||
|
||||
status, detail = scheduler.submit("send a simplex message to pepper saying hi")
|
||||
print(f"[{status}] {detail}")
|
||||
assert status in ("running", "preempted", "queued", "rejected")
|
||||
assert "new skill for simplex" in detail, (
|
||||
reply = scheduler.submit("send a simplex message to pepper saying hi")
|
||||
print(f"[{reply.status}] {reply.text}")
|
||||
assert reply.status in ("running", "queued", "rejected")
|
||||
assert "new skill for simplex" in reply.text, (
|
||||
"a send request must route to create_skill for simplex"
|
||||
)
|
||||
assert scheduler.current is None, "gate must be free again right after the draft is queued"
|
||||
@@ -625,13 +676,50 @@ def test_skill_pauses_for_input_and_resumes(tmp_path):
|
||||
assert scheduler.pending is not None
|
||||
assert scheduler.current is not None
|
||||
|
||||
status, detail = scheduler.answer("AB123")
|
||||
print(f"[{status}] {detail}")
|
||||
assert status == "ran"
|
||||
reply = scheduler.answer("AB123")
|
||||
print(f"[{reply.status}] {reply.text}")
|
||||
assert reply.status == "ran"
|
||||
assert seen == ["AB123"]
|
||||
assert scheduler.pending is None
|
||||
assert scheduler.current is None
|
||||
|
||||
rows = scheduler.trace.read()
|
||||
kinds = [e["kind"] for e in rows]
|
||||
assert "needs_input" in kinds and "answered" in kinds and "assessed" in kinds
|
||||
assert "needs_input" in kinds and "answered" in kinds and "assessed" in kinds
|
||||
|
||||
|
||||
def test_empty_result_is_assessed_as_success(tmp_path):
|
||||
"""A query skill whose correct answer is "nothing" is a successful run.
|
||||
|
||||
The `assess:outcome` options must treat a definitive empty/none result
|
||||
(empty inbox, no matching event) as success; otherwise a healthy read is
|
||||
marked failed and the repair loop offers to rewrite a working skill. This
|
||||
exercises the real engine, since only it produces the probabilities.
|
||||
"""
|
||||
config = load_config()
|
||||
require_real(config)
|
||||
engine = SemIfEngine(build_engine_config(config))
|
||||
|
||||
def act(ctx, request):
|
||||
return ActionResult(
|
||||
action_log="no unread SimpleX messages.",
|
||||
new_state="no unread SimpleX messages",
|
||||
)
|
||||
|
||||
skill = Skill(
|
||||
name="next_message",
|
||||
category="simplex",
|
||||
description="Read the next unread SimpleX message.",
|
||||
act=act,
|
||||
)
|
||||
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
|
||||
runner = SkillRunner(ActionContext(engine=engine, config={}), log)
|
||||
outcome = runner.run(skill, Request("What's my next simplex message?"))
|
||||
print(f"[{outcome.success}] {outcome.summary}")
|
||||
|
||||
assert outcome.success is True, outcome.summary
|
||||
phases = [row["extra"]["phase"] for row in log.read()]
|
||||
assert "assess:outcome" in phases
|
||||
assert "assess:requeue" not in phases, (
|
||||
"an empty discovery must not be retried or repaired"
|
||||
)
|
||||
@@ -0,0 +1,79 @@
|
||||
"""Engine config wiring: the per-machine GPU-offload knobs and the loader patch.
|
||||
|
||||
Pure stdlib: no SemIf, no llama.cpp, no GGUF. The SemIf backend is CPU-only by
|
||||
construction, so the patch that lets it offload is exercised against a fake
|
||||
backend module.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
from semif_agent.cli import build_engine_config
|
||||
from semif_agent.engine import (
|
||||
EngineConfig,
|
||||
_install_gpu_state_reset,
|
||||
_offloading_params,
|
||||
)
|
||||
|
||||
PINS = {
|
||||
"engine": {
|
||||
"source": "Qwen/Qwen3.5-4B",
|
||||
"revision": "0" * 40,
|
||||
"gguf_url": "https://example.com/Qwen_Qwen3.5-4B-Q4_K_M.gguf",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def test_engine_config_defaults_to_cpu():
|
||||
cfg = build_engine_config({"engine": {"backend": "llamacpp"}}, PINS)
|
||||
assert cfg.gpu_layers == 0
|
||||
assert cfg.gpu_device is None
|
||||
assert cfg.gpu_split == 0
|
||||
|
||||
|
||||
def test_engine_config_reads_gpu_knobs():
|
||||
cfg = build_engine_config(
|
||||
{"engine": {"gpu_layers": -1, "gpu_device": 1, "gpu_split": 0}}, PINS
|
||||
)
|
||||
assert cfg.gpu_layers == -1
|
||||
assert cfg.gpu_device == 1
|
||||
assert cfg.gpu_split == 0
|
||||
|
||||
|
||||
def test_gpu_offload_wrapper_rewrites_model_params():
|
||||
def original(library):
|
||||
return SimpleNamespace(n_gpu_layers=0, main_gpu=0, split_mode=1)
|
||||
|
||||
offloading = _offloading_params(
|
||||
original, EngineConfig(gpu_layers=99, gpu_device=1, gpu_split=0)
|
||||
)
|
||||
params = offloading(object())
|
||||
assert params.n_gpu_layers == 99
|
||||
assert params.main_gpu == 1
|
||||
assert params.split_mode == 0
|
||||
|
||||
|
||||
def test_gpu_offload_wrapper_leaves_main_gpu_when_device_unset():
|
||||
def original(library):
|
||||
return SimpleNamespace(n_gpu_layers=0, main_gpu=7, split_mode=1)
|
||||
|
||||
offloading = _offloading_params(original, EngineConfig(gpu_layers=-1))
|
||||
params = offloading(object())
|
||||
assert params.n_gpu_layers == -1
|
||||
assert params.main_gpu == 7 # untouched
|
||||
assert params.split_mode == 0
|
||||
|
||||
|
||||
def test_gpu_state_reset_clears_cache_data():
|
||||
calls = []
|
||||
|
||||
class FakeLib:
|
||||
def llama_memory_clear(self, memory, data):
|
||||
calls.append((memory, data))
|
||||
|
||||
engine = SimpleNamespace(lib=FakeLib(), memory="mem")
|
||||
engine.clear = lambda: engine.lib.llama_memory_clear(engine.memory, False)
|
||||
_install_gpu_state_reset(SimpleNamespace(engine=engine))
|
||||
engine.clear()
|
||||
assert calls == [("mem", True)]
|
||||
+11
-11
@@ -225,7 +225,7 @@ def test_service_drain_routes_queued_run_to_owner(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
service = build_service(scheduler)
|
||||
request = Request("queued work", source="simplex:4")
|
||||
scheduler.queue.push(request, 0.5)
|
||||
scheduler.queue.push(request)
|
||||
service._owners[request.id] = ("simplex", "4")
|
||||
|
||||
service.drain()
|
||||
@@ -296,15 +296,15 @@ def test_result_detail_unwraps_scheduler_summary():
|
||||
from semif_agent.gateway.service import _result_detail
|
||||
|
||||
assert _result_detail("time.now: ok — 2026-10-06 12:00") == "2026-10-06 12:00"
|
||||
assert _result_detail("interrupted x; time.now: ok — 12:00") == "12:00"
|
||||
assert _result_detail("time.now: failed — boom") == "boom"
|
||||
assert _result_detail("a plain reply") == "a plain reply"
|
||||
|
||||
|
||||
def test_result_only_speaks_detail_and_drops_status(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
service = build_result_only_service(scheduler)
|
||||
service._reply("voice", "c", "[high] time.now: ok — 12:00", kind="result")
|
||||
service._reply("voice", "c", "urgency low (weight 0.20)", kind="status")
|
||||
service._reply("voice", "c", "time.now: ok — 12:00", kind="result")
|
||||
service._reply("voice", "c", "queued", kind="status")
|
||||
service._reply("voice", "c", "Which account?", kind="question")
|
||||
assert drain_outbound(service) == ["12:00", "Which account?"]
|
||||
|
||||
@@ -312,11 +312,11 @@ def test_result_only_speaks_detail_and_drops_status(tmp_path):
|
||||
def test_plain_adapter_keeps_full_scheduler_output(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
service = build_service(scheduler) # FakeAdapter (simplex), not result_only
|
||||
service._reply("simplex", "4", "[high] time.now: ok — 12:00", kind="result")
|
||||
service._reply("simplex", "4", "urgency low (weight 0.20)", kind="status")
|
||||
service._reply("simplex", "4", "time.now: ok — 12:00", kind="result")
|
||||
service._reply("simplex", "4", "queued", kind="status")
|
||||
assert drain_outbound(service) == [
|
||||
"[high] time.now: ok — 12:00",
|
||||
"urgency low (weight 0.20)",
|
||||
"time.now: ok — 12:00",
|
||||
"queued",
|
||||
]
|
||||
|
||||
|
||||
@@ -325,9 +325,9 @@ def test_config_can_turn_result_only_off(tmp_path):
|
||||
service = build_result_only_service(
|
||||
scheduler, config={"voice": {"result_only": False}}
|
||||
)
|
||||
service._reply("voice", "c", "[high] time.now: ok — 12:00", kind="result")
|
||||
service._reply("voice", "c", "urgency low", kind="status")
|
||||
assert drain_outbound(service) == ["[high] time.now: ok — 12:00", "urgency low"]
|
||||
service._reply("voice", "c", "time.now: ok — 12:00", kind="result")
|
||||
service._reply("voice", "c", "queued", kind="status")
|
||||
assert drain_outbound(service) == ["time.now: ok — 12:00", "queued"]
|
||||
|
||||
|
||||
# ---- LXMF adapter ----
|
||||
|
||||
@@ -346,7 +346,7 @@ def test_regen_skill_rewrites_existing_body(tmp_path, monkeypatch):
|
||||
_add_skill(scheduler, "calendar", "foo")
|
||||
captured = {}
|
||||
|
||||
def fake_start(request, category, draft, weight, repair_evidence=None, reason_kind="run_failure"):
|
||||
def fake_start(request, category, draft, repair_evidence=None, reason_kind="run_failure"):
|
||||
captured.update(
|
||||
category=category,
|
||||
repair_evidence=repair_evidence,
|
||||
@@ -371,7 +371,7 @@ def test_regen_skill_stub_has_no_evidence(tmp_path, monkeypatch):
|
||||
]
|
||||
captured = {}
|
||||
|
||||
def fake_start(request, category, draft, weight, repair_evidence=None, reason_kind="run_failure"):
|
||||
def fake_start(request, category, draft, repair_evidence=None, reason_kind="run_failure"):
|
||||
captured.update(repair_evidence=repair_evidence, reason_kind=reason_kind)
|
||||
|
||||
monkeypatch.setattr(scheduler, "_start_skill_write", fake_start)
|
||||
@@ -389,7 +389,6 @@ def test_cancel_skill_build_discards_and_deletes(tmp_path):
|
||||
request=Request("build foo"),
|
||||
category="calendar",
|
||||
draft=SkillDraft(name="foo", description="d"),
|
||||
weight=0.5,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -411,7 +410,6 @@ def test_consume_cancelled_discards_queued_write(tmp_path):
|
||||
request=Request("build foo"),
|
||||
category="calendar",
|
||||
draft=SkillDraft(name="foo", description="d"),
|
||||
weight=0.5,
|
||||
)
|
||||
scheduler._cancelled.add(("calendar", "foo"))
|
||||
assert scheduler._consume_cancelled(job) is True
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
"""Pure-stdlib tests for the gateway's optional LLM result cleanup.
|
||||
|
||||
The `Humanizer` is a thin, always-falls-back rephraser over an injected client;
|
||||
the gateway wires it to the scheduler's `llm` client and only for result lines.
|
||||
No engine and no real LLM endpoint are involved — a fake client records the
|
||||
call and returns a canned reply.
|
||||
"""
|
||||
|
||||
from semif_agent.gateway.humanize import Humanizer, _clean_reply
|
||||
from semif_agent.gateway.service import GatewayService
|
||||
|
||||
|
||||
class FakeClient:
|
||||
def __init__(self, reply="", error=None):
|
||||
self.reply = reply
|
||||
self.error = error
|
||||
self.calls = []
|
||||
|
||||
def chat(self, messages, max_tokens=None, timeout=None, **kwargs):
|
||||
self.calls.append(
|
||||
{"messages": messages, "max_tokens": max_tokens, "timeout": timeout}
|
||||
)
|
||||
if self.error is not None:
|
||||
raise self.error
|
||||
return self.reply
|
||||
|
||||
|
||||
class FakeAdapter:
|
||||
name = "simplex"
|
||||
|
||||
|
||||
class FakeScheduler:
|
||||
def __init__(self, llm):
|
||||
self.llm = llm
|
||||
|
||||
|
||||
# ---- Humanizer: rewriting + fallback ----
|
||||
|
||||
def test_humanize_rewrites_and_passes_timeout():
|
||||
client = FakeClient(reply="Your event was added to the calendar.")
|
||||
h = Humanizer(client, timeout=7.0, max_tokens=64)
|
||||
assert h.humanize("PUT 201 created") == "Your event was added to the calendar."
|
||||
call = client.calls[0]
|
||||
assert call["timeout"] == 7.0
|
||||
assert call["max_tokens"] == 64
|
||||
assert "PUT 201 created" in call["messages"][1]["content"]
|
||||
|
||||
|
||||
def test_humanize_collapses_whitespace_and_strips_quotes():
|
||||
client = FakeClient(reply='"Done.\n All good."')
|
||||
assert Humanizer(client).humanize("ok") == "Done. All good."
|
||||
|
||||
|
||||
def test_humanize_falls_back_on_client_error():
|
||||
client = FakeClient(error=RuntimeError("unreachable"))
|
||||
assert Humanizer(client).humanize("raw result") == "raw result"
|
||||
|
||||
|
||||
def test_humanize_falls_back_on_empty_reply():
|
||||
client = FakeClient(reply=" ")
|
||||
assert Humanizer(client).humanize("raw result") == "raw result"
|
||||
|
||||
|
||||
def test_humanize_falls_back_on_refusal():
|
||||
client = FakeClient(reply="I cannot rewrite that.")
|
||||
assert Humanizer(client).humanize("raw result") == "raw result"
|
||||
|
||||
|
||||
def test_humanize_falls_back_on_runaway_length():
|
||||
client = FakeClient(reply="x" * 1000)
|
||||
assert Humanizer(client, max_chars=100).humanize("raw") == "raw"
|
||||
|
||||
|
||||
def test_humanize_disabled_is_passthrough_without_calling():
|
||||
client = FakeClient(reply="should not be used")
|
||||
h = Humanizer(client, enabled=False)
|
||||
assert h.humanize("raw result") == "raw result"
|
||||
assert client.calls == []
|
||||
|
||||
|
||||
def test_humanize_no_client_is_disabled():
|
||||
h = Humanizer(None)
|
||||
assert h.enabled is False
|
||||
assert h.humanize("raw result") == "raw result"
|
||||
|
||||
|
||||
def test_clean_reply_handles_empty():
|
||||
assert _clean_reply("") == ""
|
||||
assert _clean_reply(None) == ""
|
||||
|
||||
|
||||
# ---- gateway wiring ----
|
||||
|
||||
def build_service(llm, config):
|
||||
return GatewayService(FakeScheduler(llm), FakeAdapter(), config=config)
|
||||
|
||||
|
||||
def test_gateway_humanizes_only_result_lines():
|
||||
llm = FakeClient(reply="It is 12:00.")
|
||||
service = build_service(llm, {"humanize": {"enabled": True}, "simplex": {}})
|
||||
service._reply("simplex", "c", "time.now: ok — 12:00", kind="result")
|
||||
service._reply("simplex", "c", "queued", kind="status")
|
||||
service._reply("simplex", "c", "Which account?", kind="question")
|
||||
assert [service.outbound["simplex"].get_nowait().text for _ in range(3)] == [
|
||||
"It is 12:00.",
|
||||
"queued",
|
||||
"Which account?",
|
||||
]
|
||||
|
||||
|
||||
def test_gateway_humanize_off_by_default():
|
||||
llm = FakeClient(reply="should not be used")
|
||||
service = build_service(llm, {"simplex": {}})
|
||||
service._reply("simplex", "c", "time.now: ok — 12:00", kind="result")
|
||||
assert service.outbound["simplex"].get_nowait().text == "time.now: ok — 12:00"
|
||||
assert llm.calls == []
|
||||
|
||||
|
||||
def test_gateway_per_platform_override_enables():
|
||||
llm = FakeClient(reply="It is 12:00.")
|
||||
service = build_service(
|
||||
llm, {"humanize": {"enabled": False}, "simplex": {"humanize": True}}
|
||||
)
|
||||
service._reply("simplex", "c", "time.now: ok — 12:00", kind="result")
|
||||
assert service.outbound["simplex"].get_nowait().text == "It is 12:00."
|
||||
|
||||
|
||||
def test_gateway_per_platform_override_disables():
|
||||
llm = FakeClient(reply="should not be used")
|
||||
service = build_service(
|
||||
llm, {"humanize": {"enabled": True}, "simplex": {"humanize": False}}
|
||||
)
|
||||
service._reply("simplex", "c", "time.now: ok — 12:00", kind="result")
|
||||
assert service.outbound["simplex"].get_nowait().text == "time.now: ok — 12:00"
|
||||
assert llm.calls == []
|
||||
|
||||
|
||||
def test_gateway_humanize_keeps_wrapper_when_result_only_off():
|
||||
# Humanize unwraps the scheduler wrapper, like result_only, but only for
|
||||
# the result line — status chatter still flows on a plain chat platform.
|
||||
llm = FakeClient(reply="Done.")
|
||||
service = build_service(llm, {"humanize": {"enabled": True}, "simplex": {}})
|
||||
service._reply("simplex", "c", "track.manual: ok — sent", kind="result")
|
||||
assert service.outbound["simplex"].get_nowait().text == "Done."
|
||||
|
||||
|
||||
# ---- per-skill override (the skill's own config.json) ----
|
||||
|
||||
class FakeStore:
|
||||
"""Stands in for the scheduler's `body_store` (SkillStore)."""
|
||||
|
||||
def __init__(self, configs):
|
||||
self.configs = configs # {(category, name): {...}}
|
||||
|
||||
def read_config(self, category, name):
|
||||
return self.configs.get((category, name), {})
|
||||
|
||||
|
||||
class FakeSchedulerWithStore(FakeScheduler):
|
||||
def __init__(self, llm, store):
|
||||
super().__init__(llm)
|
||||
self.body_store = store
|
||||
|
||||
|
||||
def build_service_with_store(llm, config, store):
|
||||
return GatewayService(
|
||||
FakeSchedulerWithStore(llm, store), FakeAdapter(), config=config
|
||||
)
|
||||
|
||||
|
||||
def test_gateway_skill_config_disables_humanize():
|
||||
"""A skill whose own config sets humanize:false is not cleaned up, even
|
||||
when the platform/global default is on."""
|
||||
llm = FakeClient(reply="should not be used")
|
||||
store = FakeStore({("time", "now"): {"humanize": False}})
|
||||
service = build_service_with_store(
|
||||
llm, {"humanize": {"enabled": True}, "simplex": {}}, store
|
||||
)
|
||||
service._reply(
|
||||
"simplex", "c", "time.now: ok — 12:00", kind="result",
|
||||
skill_ref="time.now", result="12:00",
|
||||
)
|
||||
assert service.outbound["simplex"].get_nowait().text == "time.now: ok — 12:00"
|
||||
assert llm.calls == []
|
||||
|
||||
|
||||
def test_gateway_skill_config_enables_humanize_over_platform():
|
||||
"""A skill's own humanize:true wins over a disabled platform/global default."""
|
||||
llm = FakeClient(reply="It is 12:00.")
|
||||
store = FakeStore({("time", "now"): {"humanize": True}})
|
||||
service = build_service_with_store(
|
||||
llm,
|
||||
{"humanize": {"enabled": False}, "simplex": {"humanize": False}},
|
||||
store,
|
||||
)
|
||||
service._reply(
|
||||
"simplex", "c", "time.now: ok — 12:00", kind="result",
|
||||
skill_ref="time.now", result="12:00",
|
||||
)
|
||||
assert service.outbound["simplex"].get_nowait().text == "It is 12:00."
|
||||
|
||||
|
||||
def test_gateway_skill_config_absent_falls_back_to_platform():
|
||||
"""No skill override -> the platform/global default applies."""
|
||||
llm = FakeClient(reply="It is 12:00.")
|
||||
store = FakeStore({})
|
||||
service = build_service_with_store(
|
||||
llm, {"humanize": {"enabled": True}, "simplex": {}}, store
|
||||
)
|
||||
service._reply(
|
||||
"simplex", "c", "time.now: ok — 12:00", kind="result",
|
||||
skill_ref="time.now", result="12:00",
|
||||
)
|
||||
assert service.outbound["simplex"].get_nowait().text == "It is 12:00."
|
||||
+11
-11
@@ -67,8 +67,8 @@ def test_skill_pause_and_answer(tmp_path):
|
||||
assert scheduler.current.skill == "track.manual"
|
||||
assert scheduler.log.read() == [], "sub-decisions must be deferred until completion"
|
||||
|
||||
status, detail = scheduler.answer("AB123")
|
||||
assert status == "ran"
|
||||
reply = scheduler.answer("AB123")
|
||||
assert reply.status == "ran"
|
||||
assert seen == ["AB123"]
|
||||
assert scheduler.pending is None
|
||||
assert scheduler.current is None
|
||||
@@ -82,9 +82,9 @@ def test_skill_pause_and_answer(tmp_path):
|
||||
|
||||
def test_answer_without_pending_is_error(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
status, detail = scheduler.answer("hello")
|
||||
assert status == "error"
|
||||
assert "waiting for input" in detail
|
||||
reply = scheduler.answer("hello")
|
||||
assert reply.status == "error"
|
||||
assert "waiting for input" in reply.text
|
||||
|
||||
|
||||
def test_act_decisions_logged_on_completion(tmp_path):
|
||||
@@ -164,13 +164,13 @@ def test_resume_can_ask_again(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
|
||||
scheduler._run_skill(skill, Request("track"))
|
||||
status, detail = scheduler.answer("XYZ")
|
||||
assert status == "needs_input"
|
||||
reply = scheduler.answer("XYZ")
|
||||
assert reply.status == "needs_input"
|
||||
assert seen == ["XYZ"]
|
||||
assert scheduler.pending is not None
|
||||
|
||||
status, detail = scheduler.answer("AB123")
|
||||
assert status == "ran"
|
||||
reply = scheduler.answer("AB123")
|
||||
assert reply.status == "ran"
|
||||
assert scheduler.pending is None
|
||||
assert scheduler.current is None
|
||||
|
||||
@@ -196,8 +196,8 @@ def test_empty_answer_is_accepted_and_forwarded(tmp_path):
|
||||
result = scheduler._run_skill(skill, Request("track my package"))
|
||||
assert result.kind == "needs_input"
|
||||
|
||||
status, detail = scheduler.answer("")
|
||||
assert status == "ran", detail
|
||||
reply = scheduler.answer("")
|
||||
assert reply.status == "ran", reply.text
|
||||
assert seen == [None, ""], "the empty answer must reach act"
|
||||
assert scheduler.pending is None
|
||||
assert scheduler.current is None
|
||||
|
||||
+74
-1
@@ -11,7 +11,7 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
import pytest
|
||||
|
||||
from semif_agent.decisions import Request
|
||||
from semif_agent.llm import LLMClient, LLMError
|
||||
from semif_agent.llm import LLMClient, LLMError, SemIfLLMClient
|
||||
from semif_agent.skills import (
|
||||
CategoryDraft,
|
||||
SkillDraft,
|
||||
@@ -207,3 +207,76 @@ def test_unreachable_endpoint_raises_llm_error():
|
||||
client = LLMClient(base_url="http://127.0.0.1:1/v1", model="test", timeout=2)
|
||||
with pytest.raises(LLMError):
|
||||
client.chat([{"role": "user", "content": "hi"}])
|
||||
|
||||
|
||||
class _FakeEngine:
|
||||
"""Duck-typed stand-in for SemIfEngine: records generate() calls."""
|
||||
|
||||
def __init__(self, reply: str = "", error: Exception | None = None):
|
||||
self.reply = reply
|
||||
self.error = error
|
||||
self.calls: list[dict] = []
|
||||
|
||||
def generate(self, messages, temperature: float = 0.0, max_tokens: int = 256) -> str:
|
||||
self.calls.append(
|
||||
{"messages": messages, "temperature": temperature, "max_tokens": max_tokens}
|
||||
)
|
||||
if self.error is not None:
|
||||
raise self.error
|
||||
return self.reply
|
||||
|
||||
|
||||
def test_semif_llm_client_generates_via_engine():
|
||||
"""provider == "semif": the loaded engine model answers; a per-call
|
||||
max_tokens override wins over the client default."""
|
||||
engine = _FakeEngine('{"title": "track_live", "description": "Follow it."}')
|
||||
client = SemIfLLMClient(engine, temperature=0.0, max_tokens=256)
|
||||
out = client.chat([{"role": "user", "content": "name this"}], max_tokens=128)
|
||||
assert out == '{"title": "track_live", "description": "Follow it."}'
|
||||
call = engine.calls[0]
|
||||
assert call["max_tokens"] == 128
|
||||
assert call["temperature"] == 0.0
|
||||
assert call["messages"] == [{"role": "user", "content": "name this"}]
|
||||
|
||||
|
||||
def test_semif_llm_client_accepts_http_provider_kwargs():
|
||||
"""It is a drop-in for the HTTP clients: sampler/timeout/degeneration
|
||||
arguments are accepted and ignored, defaults apply."""
|
||||
engine = _FakeEngine("hello")
|
||||
out = SemIfLLMClient(engine).chat(
|
||||
[{"role": "user", "content": "hi"}],
|
||||
top_p=0.9,
|
||||
presence_penalty=0.1,
|
||||
frequency_penalty=0.0,
|
||||
timeout=5.0,
|
||||
degeneration_check=lambda _text: None,
|
||||
)
|
||||
assert out == "hello"
|
||||
assert engine.calls[0]["max_tokens"] == 256
|
||||
assert engine.calls[0]["temperature"] == 0.0
|
||||
|
||||
|
||||
def test_semif_llm_client_wraps_engine_failure_as_llm_error():
|
||||
client = SemIfLLMClient(_FakeEngine(error=RuntimeError("boom")))
|
||||
with pytest.raises(LLMError):
|
||||
client.chat([{"role": "user", "content": "hi"}])
|
||||
|
||||
|
||||
def test_build_llm_client_selects_provider():
|
||||
"""build_llm_client maps llm.provider to the right client class; the semif
|
||||
branch needs no model and wraps the supplied engine."""
|
||||
from semif_agent import cli
|
||||
from semif_agent.console import ConsoleLLMClient
|
||||
|
||||
engine = _FakeEngine("x")
|
||||
assert isinstance(
|
||||
cli.build_llm_client({"llm": {"provider": "semif"}}, engine), SemIfLLMClient
|
||||
)
|
||||
assert isinstance(
|
||||
cli.build_llm_client({"llm": {"provider": "ollama", "model": "m"}}, engine),
|
||||
LLMClient,
|
||||
)
|
||||
assert isinstance(
|
||||
cli.build_llm_client({"llm": {"provider": "opencode", "model": "m"}}, engine),
|
||||
ConsoleLLMClient,
|
||||
)
|
||||
+23
-58
@@ -1,74 +1,39 @@
|
||||
import pytest
|
||||
|
||||
from semif_agent.queue import UrgencyQueue
|
||||
from semif_agent.queue import RequestQueue
|
||||
from semif_agent.decisions import Request
|
||||
|
||||
|
||||
def make(text, weight):
|
||||
return Request(text=text), weight
|
||||
def make(text):
|
||||
return Request(text=text)
|
||||
|
||||
|
||||
def test_order_by_weight_desc():
|
||||
q = UrgencyQueue()
|
||||
req_a, _ = make("low", 0.25)
|
||||
req_c, _ = make("critical", 1.0)
|
||||
req_h, _ = make("high", 0.75)
|
||||
q.push(req_a, 0.25)
|
||||
q.push(req_c, 1.0)
|
||||
q.push(req_h, 0.75)
|
||||
assert q.pop().text == "critical"
|
||||
assert q.pop().text == "high"
|
||||
assert q.pop().text == "low"
|
||||
def test_fifo_order():
|
||||
q = RequestQueue()
|
||||
q.push(make("first"))
|
||||
q.push(make("second"))
|
||||
q.push(make("third"))
|
||||
assert q.pop().text == "first"
|
||||
assert q.pop().text == "second"
|
||||
assert q.pop().text == "third"
|
||||
assert q.pop() is None
|
||||
|
||||
|
||||
def test_fifo_tiebreak():
|
||||
q = UrgencyQueue()
|
||||
req_a, _ = make("first", 0.5)
|
||||
req_b, _ = make("second", 0.5)
|
||||
q.push(req_a, 0.5)
|
||||
q.push(req_b, 0.5)
|
||||
assert q.pop().text == "first"
|
||||
assert q.pop().text == "second"
|
||||
|
||||
|
||||
def test_fifo_beats_recency():
|
||||
q = UrgencyQueue()
|
||||
old, _ = make("older", 0.5)
|
||||
new, _ = make("newer", 0.5)
|
||||
q.push(old, 0.5, recency=1.0)
|
||||
q.push(new, 0.5, recency=2.0)
|
||||
assert q.pop().text == "older"
|
||||
|
||||
|
||||
def test_peek_does_not_remove():
|
||||
q = UrgencyQueue()
|
||||
req, _ = make("peek", 0.9)
|
||||
q.push(req, 0.9)
|
||||
q = RequestQueue()
|
||||
q.push(make("peek"))
|
||||
assert q.peek().text == "peek"
|
||||
assert len(q) == 1
|
||||
|
||||
|
||||
def test_bounds_reject():
|
||||
q = UrgencyQueue(max_size=2)
|
||||
assert q.push(make("a", 1.0)[0], 1.0)
|
||||
assert q.push(make("b", 1.0)[0], 1.0)
|
||||
assert not q.push(make("c", 1.0)[0], 1.0)
|
||||
q = RequestQueue(max_size=2)
|
||||
assert q.push(make("a"))
|
||||
assert q.push(make("b"))
|
||||
assert not q.push(make("c"))
|
||||
|
||||
|
||||
def test_age_raises_priority():
|
||||
q = UrgencyQueue(age_rate=1.0)
|
||||
old, _ = make("aging", 0.2)
|
||||
new, _ = make("busy", 1.0)
|
||||
q.push(old, 0.2)
|
||||
q.push(new, 1.0)
|
||||
q.age(dt=10.0)
|
||||
assert q.peek().text == "aging"
|
||||
|
||||
|
||||
def test_items_sorted():
|
||||
q = UrgencyQueue()
|
||||
q.push(make("b", 0.5)[0], 0.5)
|
||||
q.push(make("a", 1.0)[0], 1.0)
|
||||
weights = [weight for weight, _ in q.items()]
|
||||
assert weights == [1.0, 0.5]
|
||||
def test_items_in_arrival_order():
|
||||
q = RequestQueue()
|
||||
q.push(make("b"))
|
||||
q.push(make("a"))
|
||||
texts = [request.text for request in q.items()]
|
||||
assert texts == ["b", "a"]
|
||||
+98
-34
@@ -768,13 +768,14 @@ def test_navigate_category_options_carry_descriptions(tmp_path):
|
||||
|
||||
def test_navigate_category_rejected_scope_authors_category(tmp_path):
|
||||
"""The confirm guard is the category create door: a softmax winner whose
|
||||
scope the guard rejects authors a new category."""
|
||||
scope the guard rejects authors a new category. The winner is below
|
||||
`softmax_bypass_tau`, so the guard actually runs."""
|
||||
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
|
||||
trace = TraceLog(str(tmp_path / "runs.jsonl"))
|
||||
tree = _leaf_tree()
|
||||
engine = _ProbEngine(
|
||||
{
|
||||
"top-level category": {"simplex": 1.0},
|
||||
"top-level category": {"simplex": 0.45},
|
||||
"Does the scope": {"none": 1.0},
|
||||
}
|
||||
)
|
||||
@@ -785,12 +786,12 @@ def test_navigate_category_rejected_scope_authors_category(tmp_path):
|
||||
|
||||
|
||||
def test_navigate_category_confirmed_scope_descends(tmp_path):
|
||||
"""A softmax winner the guard confirms is descended into (no create)."""
|
||||
"""A below-threshold softmax winner the guard confirms is descended into."""
|
||||
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
|
||||
trace = TraceLog(str(tmp_path / "runs.jsonl"))
|
||||
engine = _ProbEngine(
|
||||
{
|
||||
"top-level category": {"simplex": 1.0},
|
||||
"top-level category": {"simplex": 0.45},
|
||||
"Does the scope": {"covers": 1.0},
|
||||
"skill performs": {"next_message": 1.0, "connect_link": 0.0},
|
||||
}
|
||||
@@ -801,6 +802,26 @@ def test_navigate_category_confirmed_scope_descends(tmp_path):
|
||||
assert any(e["kind"] == "category_scope" and e["fits"] for e in trace.read())
|
||||
|
||||
|
||||
def test_navigate_confident_category_winner_skips_scope_confirm(tmp_path):
|
||||
"""A category softmax winner at/above `softmax_bypass_tau` is decisive: the
|
||||
scope confirm is not called (no `navigate:category_scope` decision)."""
|
||||
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
|
||||
trace = TraceLog(str(tmp_path / "runs.jsonl"))
|
||||
engine = _ProbEngine(
|
||||
{
|
||||
"top-level category": {"simplex": 0.9},
|
||||
"skill performs": {"next_message": 1.0, "connect_link": 0.0},
|
||||
}
|
||||
)
|
||||
result = navigate(engine, log, trace, Request("read a message"), _leaf_tree())
|
||||
assert getattr(result, "name", None) == "next_message"
|
||||
assert any(e["kind"] == "category_scope_bypassed" for e in trace.read())
|
||||
assert not any(e["kind"] == "category_scope" for e in trace.read())
|
||||
assert all("Does the scope" not in c.question for c in engine.calls)
|
||||
phases = [r["extra"].get("phase") for r in log.read()]
|
||||
assert "navigate:category_scope" not in phases
|
||||
|
||||
|
||||
def test_confirm_category_fit_threshold(tmp_path):
|
||||
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
|
||||
trace = TraceLog(str(tmp_path / "runs.jsonl"))
|
||||
@@ -994,7 +1015,8 @@ def test_dispatch_intent_tau_controls_reuse_vs_create(tmp_path):
|
||||
{
|
||||
"top-level category": {"simplex": 1.0},
|
||||
"Does the scope": {"covers": 1.0},
|
||||
"skill performs": {"next_message": 1.0, "connect_link": 0.0},
|
||||
# Below softmax_bypass_tau (0.5), so the intent guard runs.
|
||||
"skill performs": {"next_message": 0.45, "connect_link": 0.3},
|
||||
"same action": {"same": 0.8, "different": 0.2},
|
||||
}
|
||||
)
|
||||
@@ -1022,7 +1044,7 @@ def test_dispatch_intent_tau_controls_reuse_vs_create(tmp_path):
|
||||
]
|
||||
}
|
||||
queued: list = []
|
||||
scheduler._queue_draft = lambda request, category, kind, weight: queued.append(
|
||||
scheduler._queue_draft = lambda request, category, kind: queued.append(
|
||||
(category, kind)
|
||||
)
|
||||
return scheduler, queued
|
||||
@@ -1071,7 +1093,7 @@ def test_dispatch_intent_mismatch_authorizes_new_skill(tmp_path):
|
||||
Skill(name="next_message", category="simplex", description="Read the next SimpleX message."),
|
||||
]
|
||||
queued: list = []
|
||||
scheduler._queue_draft = lambda request, category, kind, weight: queued.append(
|
||||
scheduler._queue_draft = lambda request, category, kind: queued.append(
|
||||
(category, kind)
|
||||
)
|
||||
request = Request("send a simplex message to pepper")
|
||||
@@ -1105,6 +1127,52 @@ def test_dispatch_intent_match_runs_skill(tmp_path):
|
||||
assert result.skill == "next_message"
|
||||
|
||||
|
||||
def test_dispatch_confident_leaf_winner_skips_intent_guard(tmp_path):
|
||||
"""A leaf softmax winner at/above `softmax_bypass_tau` skips the intent
|
||||
confirm: the guard would reject here (same action = different), but a
|
||||
decisive softmax runs the skill instead."""
|
||||
engine = _ProbEngine(
|
||||
{
|
||||
"top-level category": {"simplex": 1.0},
|
||||
"skill performs": {"next_message": 0.9, "connect_link": 0.1},
|
||||
"same action": {"different": 1.0},
|
||||
}
|
||||
)
|
||||
scheduler = Scheduler(
|
||||
engine=engine,
|
||||
llm=LLMClient(base_url="http://localhost:1/v1", model="test"),
|
||||
log=DecisionLog(str(tmp_path / "decisions.jsonl")),
|
||||
config={
|
||||
"skills": {},
|
||||
"category_registry": str(tmp_path / "categories.json"),
|
||||
"skill_bodies": str(tmp_path / "skills"),
|
||||
"skill_seeds": str(tmp_path / "seeds"),
|
||||
},
|
||||
trace=TraceLog(str(tmp_path / "runs.jsonl")),
|
||||
)
|
||||
|
||||
def act(ctx, request):
|
||||
return ActionResult(action_log="read fixture", new_state="read")
|
||||
|
||||
scheduler.tree = {
|
||||
"simplex": [
|
||||
Skill(
|
||||
name="next_message",
|
||||
category="simplex",
|
||||
description="Read the next SimpleX message.",
|
||||
act=act,
|
||||
),
|
||||
Skill(name="connect_link", category="simplex", description="Show the contact link."),
|
||||
]
|
||||
}
|
||||
result = scheduler._dispatch(Request("read the next simplex message"))
|
||||
assert result.kind == "ran"
|
||||
assert result.skill == "next_message"
|
||||
assert any(e["kind"] == "intent_bypass" for e in scheduler.trace.read())
|
||||
phases = [r["extra"].get("phase") for r in scheduler.log.read()]
|
||||
assert "navigate:intent" not in phases
|
||||
|
||||
|
||||
|
||||
def test_dispatch_create_category_queues_draft_and_is_not_fatal(tmp_path):
|
||||
"""An empty tree short-circuits to CreateCategory; the `llm` draft is
|
||||
@@ -1154,7 +1222,7 @@ def test_creation_approval_off_proceeds(tmp_path):
|
||||
returns immediately and posts nothing."""
|
||||
scheduler = _scheduler(tmp_path)
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"), category=None, weight=0.5, kind="category"
|
||||
request=Request("book a trip"), category=None, kind="category"
|
||||
)
|
||||
assert scheduler._request_approval(job, "category", "travel", "Trips.") is True
|
||||
assert scheduler.pending_approvals() == []
|
||||
@@ -1165,7 +1233,7 @@ def test_creation_approval_approved_proceeds(tmp_path):
|
||||
scheduler.creation_approval = True
|
||||
scheduler.defer_questions = True
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"), category=None, weight=0.5, kind="category"
|
||||
request=Request("book a trip"), category=None, kind="category"
|
||||
)
|
||||
result = {}
|
||||
thread = threading.Thread(
|
||||
@@ -1188,7 +1256,7 @@ def test_creation_approval_denied_aborts(tmp_path):
|
||||
scheduler.creation_approval = True
|
||||
scheduler.defer_questions = True
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"), category="travel", weight=0.5, kind="skill"
|
||||
request=Request("book a trip"), category="travel", kind="skill"
|
||||
)
|
||||
result = {}
|
||||
thread = threading.Thread(
|
||||
@@ -1211,7 +1279,7 @@ def test_creation_approval_timeout_denies(tmp_path):
|
||||
scheduler.defer_questions = True
|
||||
scheduler.elicitation_wait = 0.1
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"), category="travel", weight=0.5, kind="skill"
|
||||
request=Request("book a trip"), category="travel", kind="skill"
|
||||
)
|
||||
assert scheduler._request_approval(job, "skill", "book_flight", "Book.") is False
|
||||
assert any(
|
||||
@@ -1226,7 +1294,7 @@ def test_creation_approval_without_front_end_denies(tmp_path):
|
||||
scheduler.creation_approval = True
|
||||
scheduler.defer_questions = False
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"), category="travel", weight=0.5, kind="skill"
|
||||
request=Request("book a trip"), category="travel", kind="skill"
|
||||
)
|
||||
assert scheduler._request_approval(job, "skill", "book_flight", "Book.") is False
|
||||
assert any(
|
||||
@@ -1242,7 +1310,6 @@ def test_creation_approval_chain_skips_second_prompt(tmp_path):
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"),
|
||||
category="travel",
|
||||
weight=0.5,
|
||||
kind="skill",
|
||||
approved=True,
|
||||
)
|
||||
@@ -1261,7 +1328,7 @@ def test_author_category_denied_does_not_register(tmp_path, monkeypatch):
|
||||
lambda client, request, tree: CategoryDraft(name="travel", description="Trips."),
|
||||
)
|
||||
job = DraftAuthor(
|
||||
request=Request("book a trip"), category=None, weight=0.5, kind="category"
|
||||
request=Request("book a trip"), category=None, kind="category"
|
||||
)
|
||||
thread = threading.Thread(target=scheduler._author_category, args=(job,))
|
||||
thread.start()
|
||||
@@ -1283,7 +1350,7 @@ def test_author_skill_denied_does_not_register(tmp_path, monkeypatch):
|
||||
),
|
||||
)
|
||||
job = DraftAuthor(
|
||||
request=Request("book a flight"), category="travel", weight=0.5, kind="skill"
|
||||
request=Request("book a flight"), category="travel", kind="skill"
|
||||
)
|
||||
thread = threading.Thread(target=scheduler._author_skill, args=(job,))
|
||||
thread.start()
|
||||
@@ -1334,7 +1401,7 @@ def test_dispatch_skill_awaiting_body_does_not_reauthor(tmp_path):
|
||||
scheduler = _scheduler(tmp_path)
|
||||
request = Request("track my package")
|
||||
request.meta["awaiting_skill_body"] = ["tracking", "track_live"]
|
||||
result = scheduler._dispatch_skill(request, "tracking", 0.5)
|
||||
result = scheduler._dispatch_skill(request, "tracking")
|
||||
assert result.kind == "create_skill"
|
||||
assert "track_live" in result.summary
|
||||
assert "restart" in result.summary
|
||||
@@ -1369,7 +1436,7 @@ def test_async_skill_write_materializes_merges_and_requeues(tmp_path):
|
||||
leaf = scheduler.tree["tracking"][0]
|
||||
|
||||
request = Request("track my drone delivery in real time")
|
||||
scheduler._start_skill_write(request, "tracking", SkillDraft(name="track_live", description="Follow a package."), 0.5)
|
||||
scheduler._start_skill_write(request, "tracking", SkillDraft(name="track_live", description="Follow a package."))
|
||||
|
||||
assert leaf.writing is True
|
||||
deadline = time.monotonic() + 10
|
||||
@@ -1420,7 +1487,7 @@ def test_async_skill_write_fails_gracefully_on_bad_contract(tmp_path):
|
||||
leaf = scheduler.tree["tracking"][0]
|
||||
|
||||
request = Request("track my drone delivery in real time")
|
||||
scheduler._start_skill_write(request, "tracking", SkillDraft(name="track_live", description="Follow a package."), 0.5)
|
||||
scheduler._start_skill_write(request, "tracking", SkillDraft(name="track_live", description="Follow a package."))
|
||||
|
||||
deadline = time.monotonic() + 10
|
||||
failed = None
|
||||
@@ -1470,7 +1537,7 @@ def test_async_skill_write_fails_gracefully_on_unimported_names(tmp_path):
|
||||
|
||||
request = Request("track my drone delivery in real time")
|
||||
scheduler._start_skill_write(
|
||||
request, "tracking", SkillDraft(name="track_live", description="Follow a package."), 0.5
|
||||
request, "tracking", SkillDraft(name="track_live", description="Follow a package.")
|
||||
)
|
||||
|
||||
deadline = time.monotonic() + 10
|
||||
@@ -1524,15 +1591,15 @@ def test_skill_pre_act_contract_pause_and_resume(tmp_path):
|
||||
assert scheduler.pending is not None
|
||||
assert scheduler.pending.pre_act is True
|
||||
|
||||
status, detail = scheduler.answer("AB123")
|
||||
assert status == "needs_input"
|
||||
reply = scheduler.answer("AB123")
|
||||
assert reply.status == "needs_input"
|
||||
assert scheduler.pending is not None
|
||||
assert scheduler.pending.pre_act is False
|
||||
assert scheduler.pending.request.meta["config_answers"]["token"] == "AB123"
|
||||
assert "Confirm?" in scheduler.pending.question
|
||||
|
||||
status, detail = scheduler.answer("yes")
|
||||
assert status == "ran"
|
||||
reply = scheduler.answer("yes")
|
||||
assert reply.status == "ran"
|
||||
assert scheduler.pending is None
|
||||
|
||||
|
||||
@@ -1564,8 +1631,8 @@ def test_pre_act_skip_leaves_variable_unset_and_does_not_reask(tmp_path):
|
||||
assert result.kind == "needs_input"
|
||||
assert scheduler.pending is not None and scheduler.pending.pre_act is True
|
||||
|
||||
status, detail = scheduler.answer("")
|
||||
assert status == "ran", detail
|
||||
reply = scheduler.answer("")
|
||||
assert reply.status == "ran", reply.text
|
||||
assert scheduler.pending is None
|
||||
assert "token" not in seen, "a skipped variable must stay unset"
|
||||
|
||||
@@ -1597,13 +1664,13 @@ def test_pre_act_skip_advances_to_next_missing_variable(tmp_path):
|
||||
assert result.kind == "needs_input"
|
||||
assert "`alpha`" in result.summary
|
||||
|
||||
status, detail = scheduler.answer("")
|
||||
assert status == "needs_input"
|
||||
reply = scheduler.answer("")
|
||||
assert reply.status == "needs_input"
|
||||
assert scheduler.pending is not None
|
||||
assert "`beta`" in scheduler.pending.question
|
||||
|
||||
status, detail = scheduler.answer("")
|
||||
assert status == "ran", detail
|
||||
reply = scheduler.answer("")
|
||||
assert reply.status == "ran", reply.text
|
||||
assert "alpha" not in seen and "beta" not in seen
|
||||
|
||||
|
||||
@@ -1642,7 +1709,7 @@ def test_deferred_elicitation_asks_and_records(tmp_path):
|
||||
scheduler.elicitation_enabled = True
|
||||
request = Request("track my package")
|
||||
draft = SkillDraft(name="track_live", description="Follow a package.")
|
||||
job = SkillWrite(request=request, category="tracking", draft=draft, weight=0.5)
|
||||
job = SkillWrite(request=request, category="tracking", draft=draft)
|
||||
|
||||
def answerer() -> None:
|
||||
deadline = time.monotonic() + 5
|
||||
@@ -1680,7 +1747,7 @@ def test_async_skill_write_regen_ladder_on_failing_test(tmp_path):
|
||||
|
||||
request = Request("track my drone delivery in real time")
|
||||
scheduler._start_skill_write(
|
||||
request, "tracking", SkillDraft(name="track_live", description="Follow a package."), 0.5
|
||||
request, "tracking", SkillDraft(name="track_live", description="Follow a package.")
|
||||
)
|
||||
|
||||
deadline = time.monotonic() + 10
|
||||
@@ -1751,7 +1818,6 @@ def test_post_questions_asks_one_at_a_time(tmp_path):
|
||||
request=Request("track it"),
|
||||
category="tracking",
|
||||
draft=SkillDraft(name="probe", description="Probe."),
|
||||
weight=0.5,
|
||||
)
|
||||
result: dict = {}
|
||||
thread = threading.Thread(
|
||||
@@ -1790,7 +1856,6 @@ def test_post_questions_timeout_drops_remaining(tmp_path):
|
||||
request=Request("track it"),
|
||||
category="tracking",
|
||||
draft=SkillDraft(name="probe", description="Probe."),
|
||||
weight=0.5,
|
||||
)
|
||||
result: dict = {}
|
||||
thread = threading.Thread(
|
||||
@@ -1818,7 +1883,6 @@ def test_post_questions_times_out(tmp_path):
|
||||
request=Request("track it"),
|
||||
category="tracking",
|
||||
draft=SkillDraft(name="probe", description="Probe."),
|
||||
weight=0.5,
|
||||
)
|
||||
assert scheduler._post_questions(job, ["Q?"]) == {}
|
||||
assert scheduler.pending_questions() == []
|
||||
|
||||
@@ -94,3 +94,41 @@ def test_non_positive_duration_rejected():
|
||||
raise AssertionError("expected ValueError for a non-positive duration")
|
||||
finally:
|
||||
service.stop()
|
||||
|
||||
|
||||
def test_resolve_timezone_falls_back_to_host_local():
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from semif_agent.timers import resolve_timezone
|
||||
|
||||
assert resolve_timezone(None) is None
|
||||
assert resolve_timezone({}) is None
|
||||
assert resolve_timezone({"timezone": ""}) is None
|
||||
assert resolve_timezone({"timezone": " "}) is None
|
||||
assert resolve_timezone({"timezone": "Not/AZone"}) is None
|
||||
assert resolve_timezone({"timezone": "America/Chicago"}) == ZoneInfo("America/Chicago")
|
||||
|
||||
|
||||
def test_local_now_uses_configured_timezone():
|
||||
from semif_agent.timers import local_now
|
||||
|
||||
now = local_now({"timezone": "America/Chicago"})
|
||||
assert now.tzinfo is not None
|
||||
assert now.utcoffset() in (timedelta(hours=-5), timedelta(hours=-6))
|
||||
# No configured zone -> an aware host-local time, never naive.
|
||||
assert local_now({}).tzinfo is not None
|
||||
|
||||
|
||||
def test_timer_due_and_fired_time_use_configured_timezone():
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
service = TimerService(timezone="America/Chicago")
|
||||
try:
|
||||
timer = service.set_timer(3600, "1 hour")
|
||||
assert timer.due_datetime().tzinfo == ZoneInfo("America/Chicago")
|
||||
# 1700000000 == 2023-11-14 22:13:20 UTC == 16:13:20 in Chicago (CST).
|
||||
message = service._message(timer, 1700000000)
|
||||
expected = datetime.fromtimestamp(1700000000, tz=ZoneInfo("America/Chicago")).strftime("%H:%M")
|
||||
assert expected in message, message
|
||||
finally:
|
||||
service.stop()
|
||||
Reference in new issue
Block a user