Files
lotherkandClaude Sonnet 5.5 2e7a88c462 usable: opencode-go session header, embedded catalogs, locale fixes, calmer UI, --doctor
- openai transport sends x-opencode-session (opencode-go refused every request
  without it) and a splinter user agent
- the message catalogues are compiled in: an installed binary no longer shows
  raw keys (ui.ready ...); LANG=de_DE now selects German (lang was emptied by an
  overlapping snprintf), pt_BR is matched
- sidebar rewritten (agent, provider/model, usage, goal/plan, last turn);
  idle widgets say nothing; status line shows only what matters
- tool calls shown readable instead of JSON with \u escapes
- providers without their key variable are skipped by pools and refused by -m
  with a clear message; --doctor checks every provider

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 03:22:49 +00:00

88 lines
1.8 KiB
C

/*
* splinter -- delegation scheduler (auto-retry due jobs).
*
* Ticks periodically and retries one due durable delegation job
* (waiting_quota / waiting_poll / queued with run_after/next_poll_at reached).
* This enables "quota back in N days -> auto-scheduled" when combined with
* provider preflight/account and durable job records.
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "splinter.h"
#include "splinter_plugin.h"
static struct sp_host *host_ref;
static char last_status[256];
static long last_run;
static void
publish(struct sp_host *h)
{
char buf[320];
if (!h) return;
if (last_status[0])
snprintf(buf, sizeof(buf), "%s", last_status);
else
buf[0] = '\0';
sp_host_widget_text(h, "scheduler", buf);
}
static int
sched_tick(struct sp_host *h, const char *name, void *ctx)
{
struct sp_buf out;
long now = (long)time(NULL);
int rc;
(void)name; (void)ctx;
if (now - last_run < 15)
return 0;
last_run = now;
if (sp_buf_init(&out) != 0)
return 0;
rc = sp_delegate_tick(&out);
if (out.p && strstr(out.p, "none due") == NULL) {
snprintf(last_status, sizeof(last_status), "%.200s",
out.p ? out.p : (rc == 0 ? "ok" : "err"));
} else if (last_status[0] == '\0') {
snprintf(last_status, sizeof(last_status), "idle");
}
sp_buf_free(&out);
publish(h ? h : host_ref);
return 0;
}
static const struct sp_widget widget = {
"scheduler",
sched_tick,
NULL,
NULL,
30000 /* 30s */
};
static int
scheduler_init(struct sp_host *h)
{
host_ref = h;
snprintf(last_status, sizeof(last_status), "idle");
(void)sp_host_add_widget(h, &widget);
publish(h);
return 0;
}
static const struct sp_plugin plugin = {
SP_PLUGIN_ABI,
"scheduler",
"0.1",
scheduler_init,
NULL,
NULL
};
const struct sp_plugin *
sp_plugin_describe(void)
{
return &plugin;
}