Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ curl -X POST -H "Authorization: Bearer $FACTORIZE_ACCESS_TOKEN" \
https://app.factorize.sh/api/v1/runs/RUN_ID/stop
```

Job CRUD is available at `/jobs` and `/jobs/:id`. Run collections return `{ "items": [...], "nextCursor": "..." }`; pass `nextCursor` back as the `cursor` query parameter. Runs can be filtered by `jobId`, `state`, and `contextQuery`; context queries use case-insensitive literal substring matching and matching items contain a bounded `context_excerpt`, never the full context. `GET /runs/:runId` returns the complete structured trigger `context` and invocation metadata, including the firing `trigger_id`. The canonical Job prompt contract is documented in [docs/job-trigger-context.md](docs/job-trigger-context.md). Errors consistently use `{ "error": { "code": "...", "message": "..." } }`.
Job CRUD is available at `/jobs` and `/jobs/:id`; job metadata includes `currentRuns` and `maxConcurrency`. Run collections return `{ "items": [...], "nextCursor": "..." }`; pass `nextCursor` back as the `cursor` query parameter. Runs can be filtered by `jobId`, `state`, and `contextQuery`; context queries use case-insensitive literal substring matching and matching items contain a bounded `context_excerpt`, never the full context. `GET /runs/:runId` returns the complete structured trigger `context` and invocation metadata, including the firing `trigger_id`. The canonical Job prompt contract is documented in [docs/job-trigger-context.md](docs/job-trigger-context.md). Errors consistently use `{ "error": { "code": "...", "message": "..." } }`.

## MCP clients

Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/protected-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ async function mcp(request: Request, service: ApiService, env: Env, ctx: Executi
tool("list_runs", "List authoritative job runs by job ID, state, and an optional case-insensitive literal substring of triggered context. Automatic webhook, schedule, and lifecycle signals coalesce, so query runs and the provider API for authoritative work. Context matches include only a bounded excerpt.", listRunsSchema, (input: any) => service.listRuns(queryOf(input)));
tool("get_run", "Get a run with its full triggered context, invocation metadata, execution metadata, output, and activity. For manual invocations, invocation.idempotency_key is the client-reusable value; invocation.claim_key is internal.", runIdSchema, ({ runId }: any) => service.getRun(runId));
tool("stop_run", "Stop an active run", runIdSchema, ({ runId }: any) => service.stopRun(runId));
tool("list_jobs", "List jobs", z.object({}), () => service.listJobs());
tool("get_job", "Get a job", jobIdSchema, ({ jobId }: any) => service.getJob(jobId));
tool("list_jobs", "List jobs with their current run count and maximum concurrency", z.object({}), () => service.listJobs());
tool("get_job", "Get a job with its current run count and maximum concurrency", jobIdSchema, ({ jobId }: any) => service.getJob(jobId));
tool("create_job", "Create a job using an executionTargetId returned by list_execution_targets. Credentials are never accepted or returned.", jobInputSchema, (input: any) => service.createJob(input));
tool("update_job", "Replace a job configuration. Credentials are never accepted or returned.", jobInputSchema.extend({ jobId: z.string().min(1) }), ({ jobId, ...input }: any) => service.updateJob(jobId, input));
tool("delete_job", "Delete a job and its queued invocation history", jobIdSchema, ({ jobId }: any) => service.deleteJob(jobId));
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ export class TenantV2 extends DurableObject<Env> {
promptTemplate: await decrypt(String(row.encrypted_prompt_template), this.env.CREDENTIAL_ENCRYPTION_KEY),
concurrencyLimit: Number(row.concurrency_limit),
runningCount: Number(runSummary?.running_count ?? 0),
maxConcurrency: Number(row.concurrency_limit),
currentRuns: Number(runSummary?.running_count ?? 0),
lastRunState: runSummary?.last_run_state ?? null,
executionTargetId: `${executionTarget.backendKind === "amp" ? "amp:" : ""}${String(executionTarget.connectionId ?? "")}`,
triggers: publicTriggers,
Expand Down
2 changes: 2 additions & 0 deletions packages/app/test/fresh-namespace.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ describe("fresh TenantV2 namespace", () => {
promptTemplate: "{{trigger-1.prompt}}",
executionTargetId: "amp:execution-1",
runningCount: 0,
currentRuns: 0,
maxConcurrency: 1,
lastRunState: null,
triggers: [{ kind: "manual", slug: "trigger-1" }],
});
Expand Down