loopengine 0.4.11 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,15 +43,34 @@ export interface ChainStep {
43
43
  }
44
44
  /** Runs a chain may start one after another, after the first. */
45
45
  export declare const MAX_CHAIN_DEPTH = 5;
46
- /** An assignment try as the page shows it: its run's state and result. */
47
- export interface AssignmentView {
48
- runId: string;
49
- status: 'running' | 'awaiting_approval' | 'done' | 'error' | 'gone';
50
- result?: string;
51
- error?: string;
52
- note?: string;
53
- at: string;
46
+ /** A group of workflows under a goal: steps that run in order (only
47
+ * "sequence" for now), each built as its own workflow. Once two steps in
48
+ * a row are built, the next is chained to start after the one before
49
+ * (GoalJob.chain), given its result. */
50
+ export interface WorkflowGroup {
51
+ order: 'sequence';
52
+ steps: GroupStep[];
53
+ }
54
+ export interface GroupStep {
55
+ id: string;
56
+ /** A short label for its workflow ("Lead scan"). */
57
+ name: string;
58
+ request: string;
59
+ agent: {
60
+ name: string;
61
+ isNew: boolean;
62
+ instructions?: string;
63
+ };
64
+ needs: GoalNeed[];
65
+ /** The workflow built for it, once built. */
66
+ built?: {
67
+ agent: string;
68
+ workflowId: string;
69
+ };
54
70
  }
71
+ /** A suggestion under a goal: one workflow, or a group of them (`group`).
72
+ * Stored as before under the name "job" (a goal's `jobs`), so saved
73
+ * goals keep working; the console calls it a workflow or a group. */
55
74
  export interface GoalJob {
56
75
  id: string;
57
76
  title: string;
@@ -82,12 +101,13 @@ export interface GoalJob {
82
101
  restoreTo?: 'suggested';
83
102
  /** What does it, once built: the workflow (skill id) on its agent. */
84
103
  doers: JobDoer[];
85
- /** When a once job was marked done. */
104
+ /** Older one-off jobs: when marked done, and the accepted result. */
86
105
  doneAt?: string;
87
- /** The accepted result of a once job's assignment. */
88
106
  result?: string;
89
107
  /** For a recurring job done by several workflows: what runs after what. */
90
108
  chain?: ChainStep[];
109
+ /** A group of workflows that run in order, instead of one. */
110
+ group?: WorkflowGroup;
91
111
  /** A job the person added themselves: their own words, and how the
92
112
  * planner judged it ("changed" or "warned", with its note). */
93
113
  added?: {
@@ -117,9 +137,6 @@ export interface GoalJob {
117
137
  };
118
138
  /** Which generation suggested it (1 on create). */
119
139
  round: number;
120
- /** When it was added to the person's own list of jobs (the Jobs page):
121
- * with Add to my jobs, on Build or Assign, or when submitted there. */
122
- addedAt?: string;
123
140
  }
124
141
  /** Before jobs: the same thing, called a workflow under its goal. */
125
142
  export type GoalWorkflow = GoalJob;
@@ -147,15 +164,12 @@ export interface Goal {
147
164
  jobs: GoalJob[];
148
165
  createdAt: string;
149
166
  updatedAt: string;
150
- /** The built-in holder of jobs submitted on the Jobs page without a
151
- * goal (MY_JOBS_ID): never listed as a goal. */
167
+ /** The holder of jobs once submitted without a goal (before goals held
168
+ * only workflows): never listed as a goal. */
152
169
  standalone?: true;
153
170
  }
154
171
  export declare class GoalError extends Error {
155
172
  }
156
- /** Where jobs submitted without a goal live: a goal file of its own, so
157
- * building, assigning, chains and runs work for them as for any job. */
158
- export declare const MY_JOBS_ID = "g-my-jobs";
159
173
  export type EditAmount = 'none' | 'light' | 'heavy';
160
174
  export declare const DISCARD_REASONS: readonly ["not-relevant", "too-much-work", "already-doing-it", "other"];
161
175
  export type DiscardReason = (typeof DISCARD_REASONS)[number];
@@ -175,14 +189,6 @@ export interface GoalsDeps {
175
189
  runs: number;
176
190
  done: number;
177
191
  }>;
178
- /** Starts a once job's assignment: one unattended run of the agent with
179
- * this message; returns its run id. */
180
- startAssignment?: (agent: string, message: string, job: {
181
- goal: string;
182
- job: string;
183
- }) => Promise<{
184
- runId: string;
185
- }>;
186
192
  /** A workflow on an agent, when it exists: its title and inputs (for
187
193
  * linking it to a job and checking a chain). */
188
194
  workflowInfo?: (agent: string, workflowId: string) => {
@@ -191,19 +197,11 @@ export interface GoalsDeps {
191
197
  required: boolean;
192
198
  }>;
193
199
  } | undefined;
194
- /** An assignment run's state, for the page. */
195
- assignmentRun?: (agent: string, runId: string) => Promise<{
196
- status: AssignmentView['status'];
197
- result?: string;
198
- error?: string;
199
- } | undefined>;
200
200
  }
201
201
  /** A goal as saved before jobs (its `workflows`, a built one's `built`
202
202
  * link) read as one with jobs; one saved since, as it is. Each becomes a
203
- * job: a built one active, done by its workflow; one not built yet takes
204
- * the kind its playbook lever usually makes (a finite list is a one-off
205
- * job). Each gets a measure: the lever's, else how it was said to move
206
- * the goal. */
203
+ * recurring job: a built one active, done by its workflow. Each gets a
204
+ * measure: the lever's, else how it was said to move the goal. */
207
205
  export declare function migrateGoal(raw: Record<string, unknown>): Goal;
208
206
  /** Rewrites every goal saved before jobs in the new form (jobs, with
209
207
  * their workflows as doers), once, at start. Returns how many changed. */
@@ -242,12 +240,12 @@ export declare function generateMore(deps: GoalsDeps, id: string, input?: {
242
240
  }): Goal;
243
241
  export declare function setWorkflowState(deps: GoalsDeps, id: string, workflowId: string, action: unknown, reason?: unknown): Goal;
244
242
  /** Build: makes the suggested agent when there is none by that name,
245
- * then returns where the work starts. A recurring job goes to Build a
246
- * workflow, with the request and the agent filled in and the goal to link
247
- * the result back to; a once job opens Chat with the agent, the request
248
- * ready to send. */
243
+ * then returns Build a workflow's address, with the request and the agent
244
+ * filled in and the goal to link the result back to. For a group, `step`
245
+ * says which of its workflows. */
249
246
  export declare function prepareBuild(deps: GoalsDeps, id: string, workflowId: string, opts?: {
250
247
  another?: boolean;
248
+ step?: string;
251
249
  }): Promise<{
252
250
  goal: Goal;
253
251
  agent: string;
@@ -261,6 +259,7 @@ export declare function markBuilt(deps: GoalsDeps, id: string, workflowId: strin
261
259
  workflowId?: unknown;
262
260
  title?: unknown;
263
261
  description?: unknown;
262
+ step?: unknown;
264
263
  }): Goal;
265
264
  export declare function addJob(deps: GoalsDeps, id: string, input: {
266
265
  idea?: unknown;
@@ -272,42 +271,12 @@ export declare function addJob(deps: GoalsDeps, id: string, input: {
272
271
  alternative: string;
273
272
  jobId?: string;
274
273
  }>;
275
- /** Adds a job to the person's list, or takes it off (it stays under its goal). */
276
- export declare function listJob(deps: GoalsDeps, id: string, jobId: string, on: boolean): Goal;
277
- /** When a job joined the list: when added, else when it was first built
278
- * or assigned (jobs built before the list existed). */
279
- /** The jobs each workflow does, keyed "agent|workflowId": every job
280
- * (not discarded) that lists it as a doer, for "For job" on the
281
- * workflow's page. */
274
+ /** The goals each workflow was built for ("agent|workflowId" -> goals,
275
+ * each its id and its words), for a workflow's "For goal". */
282
276
  export declare function jobsByWorkflow(deps: GoalsDeps): Map<string, {
283
277
  id: string;
284
278
  title: string;
285
279
  }[]>;
286
- export interface ListedJob {
287
- goalId: string;
288
- /** The goal it came from; null for a job submitted without one. */
289
- goal: string | null;
290
- addedAt: string;
291
- job: GoalJob & {
292
- tries?: AssignmentView[];
293
- };
294
- }
295
- /** The person's jobs, newest added first: every job on the list, from any
296
- * goal, and every job submitted without one (discarded ones left out). */
297
- export declare function listJobs(deps: GoalsDeps): Promise<ListedJob[]>;
298
- /** A job the person submits on the Jobs page, with no goal: shaped and
299
- * judged like one added under a goal (judged on its own), and put on
300
- * their list, ready to build or assign. */
301
- export declare function submitJob(deps: GoalsDeps, input: {
302
- idea?: unknown;
303
- share?: unknown;
304
- }): Promise<{
305
- verdict: 'added' | 'changed' | 'warned' | 'refused';
306
- note: string;
307
- alternative: string;
308
- goalId: string;
309
- jobId?: string;
310
- }>;
311
280
  /** Checks a chain against the job's workflows: each step joins two of
312
281
  * them, its condition and inputs make sense, every required input of the
313
282
  * next run is filled, and nothing loops. Returns it tidied, with ids. */
@@ -343,27 +312,10 @@ export declare function chainedRuns(deps: GoalsDeps, run: {
343
312
  params: Record<string, string>;
344
313
  depth: number;
345
314
  }[];
346
- /** What an assignment run starts with: the goal and the job, the request,
347
- * and, when asking again, the previous result and the person's note. */
348
- export declare function assignmentMessage(goal: Goal, job: GoalJob, again?: {
349
- previous?: string;
350
- note?: string;
351
- }): string;
352
- /** Assigns a once job to its agent (making the agent first when there is
353
- * none), or, with a note, asks again after a try that finished or
354
- * failed. */
355
- export declare function assignJob(deps: GoalsDeps, id: string, jobId: string, input?: {
356
- note?: unknown;
357
- }): Promise<Goal>;
358
- /** Accepts a once job's latest result: the job is done, the result kept. */
359
- export declare function acceptJob(deps: GoalsDeps, id: string, jobId: string): Promise<Goal>;
360
- /** A goal with its once jobs' tries as the page shows them: each one's
361
- * run state and result. */
362
- export declare function goalView(deps: GoalsDeps, goal: Goal): Promise<Goal & {
363
- jobs: (GoalJob & {
364
- tries?: AssignmentView[];
365
- })[];
366
- }>;
315
+ /** A goal as its page shows it: its workflows and groups. One-off jobs
316
+ * (from before goals suggested only workflows) are left out; their
317
+ * files keep them. */
318
+ export declare function goalView(_deps: GoalsDeps, goal: Goal): Promise<Goal>;
367
319
  /** none (same words), light (mostly the same: names, a schedule, tone)
368
320
  * or heavy (a different request), by how many words the two share. */
369
321
  export declare function editAmount(before: string, after: string): EditAmount;