@amalgm/automations 0.4.4-main.37557337400 → 0.4.4-main.39177734548

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.
package/PURPOSE.md CHANGED
@@ -56,7 +56,9 @@ each host forwards only to the owning machine and schedules the next durable
56
56
  retry or lease deadline. Notifications carry no workflow data and never replace
57
57
  the run ledger. Reconnecting re-establishes notification coverage before checking
58
58
  the ledger. Connection health and active execution leases have bounded timers;
59
- idle machines have no periodic work-claim timer.
59
+ idle machines have no periodic work-claim timer. A claimed run executing here
60
+ is work running here: the worker tells its host how many are executing, from
61
+ creation on and on every change. Schedules waiting for their time are not.
60
62
 
61
63
  Complete create and update requests validate their supplied schedules, workflow
62
64
  plans, and field names before writing configuration. Unknown fields cannot
package/README.md CHANGED
@@ -109,7 +109,8 @@ It is global configuration control. Invoke it from any directory; automation
109
109
  state is owned by the service and execution is owned by the selected machine.
110
110
  The directory in which an agent creates a definition is never captured. Put an
111
111
  absolute `cwd` on a command or script when location matters. When `cwd` is
112
- omitted, Amalgm Shell deliberately uses the user's OS home on that machine.
112
+ omitted, Amalgm Shell runs the step in the user's Workspaces folder on that
113
+ machine.
113
114
 
114
115
  ```bash
115
116
  amalgm automations create --stdin <<'JSON'
@@ -1 +1 @@
1
- {"$schema":"https://schemas.agentskills.io/discovery/0.2.0/schema.json","skills":[{"name":"amalgm-automations","description":"Set up and use Amalgm to schedule workflows, run native agents and scripts, receive webhooks, and inspect automation results through the amalgm CLI or an existing MCP connection.","type":"archive","url":"./amalgm-automations.3387e2eba4a15a5df5ae9c6930a1cfae5bff260c83a18fb478c137d41ab796db.tgz","digest":"sha256:3387e2eba4a15a5df5ae9c6930a1cfae5bff260c83a18fb478c137d41ab796db"}]}
1
+ {"$schema":"https://schemas.agentskills.io/discovery/0.2.0/schema.json","skills":[{"name":"amalgm-automations","description":"Set up and use Amalgm to schedule workflows, run native agents and scripts, receive webhooks, and inspect automation results through the amalgm CLI or an existing MCP connection.","type":"archive","url":"./amalgm-automations.4db7dc9a10446c1bc36b43b769faff2a3e2cbebab28460a850154ce5f4f83cd3.tgz","digest":"sha256:4db7dc9a10446c1bc36b43b769faff2a3e2cbebab28460a850154ce5f4f83cd3"}]}
@@ -1,7 +1,7 @@
1
1
  import type { AutomationProcessPort } from './execution-contract.js';
2
2
  export interface NodeAutomationProcessHostOptions {
3
- /** Used only when a step omits cwd. Shell should supply the user's OS home. */
4
- readonly defaultCwd?: string;
3
+ /** The folder a step runs in when it omits cwd. Shell supplies the user's Workspaces folder. */
4
+ readonly defaultCwd: string;
5
5
  /** Machine-host environment inherited by child processes. */
6
6
  readonly environment?: NodeJS.ProcessEnv;
7
7
  readonly shellCommand?: string;
@@ -10,4 +10,4 @@ export interface NodeAutomationProcessHostOptions {
10
10
  readonly terminateGraceMs?: number;
11
11
  }
12
12
  /** Node machine adapter for the SDK's process capability. */
13
- export declare function createNodeAutomationProcessHost(options?: NodeAutomationProcessHostOptions): AutomationProcessPort;
13
+ export declare function createNodeAutomationProcessHost(options: NodeAutomationProcessHostOptions): AutomationProcessPort;
@@ -6,8 +6,8 @@ const DEFAULT_TIMEOUT_MS = 30 * 60_000;
6
6
  const DEFAULT_MAX_OUTPUT_BYTES = 1024 * 1024;
7
7
  const DEFAULT_TERMINATE_GRACE_MS = 1_000;
8
8
  /** Node machine adapter for the SDK's process capability. */
9
- export function createNodeAutomationProcessHost(options = {}) {
10
- const defaultCwd = options.defaultCwd ?? process.cwd();
9
+ export function createNodeAutomationProcessHost(options) {
10
+ const { defaultCwd } = options;
11
11
  if (!isAbsolute(defaultCwd))
12
12
  throw new Error('Automation process defaultCwd must be absolute');
13
13
  const environment = stringEnvironment(options.environment ?? process.env);
@@ -13,7 +13,9 @@ export interface CapturedProcess {
13
13
  readonly timedOut: boolean;
14
14
  readonly aborted: boolean;
15
15
  }
16
- export declare function captureProcess(invocation: ProcessInvocation, input: AutomationProcessExecution, defaults: Readonly<{
16
+ export declare function captureProcess(invocation: ProcessInvocation, input: AutomationProcessExecution & {
17
+ readonly cwd: string;
18
+ }, defaults: Readonly<{
17
19
  timeoutMs: number;
18
20
  maximumBytes: number;
19
21
  terminateGraceMs: number;
@@ -6,7 +6,7 @@ export function captureProcess(invocation, input, defaults) {
6
6
  let child;
7
7
  try {
8
8
  child = spawn(invocation.command, invocation.args, {
9
- cwd: input.cwd ?? process.cwd(),
9
+ cwd: input.cwd,
10
10
  env: input.env,
11
11
  detached: process.platform !== 'win32',
12
12
  shell: false,
@@ -8,6 +8,8 @@ export interface AutomationMachineRunnerOptions {
8
8
  readonly reconnectDelayMs?: number;
9
9
  readonly maxBackoffMs?: number;
10
10
  readonly log?: (event: string, details?: Readonly<Record<string, unknown>>) => void;
11
+ /** Called with how many claimed runs are executing here, at creation and on every change. */
12
+ readonly activity?: (count: number) => void;
11
13
  }
12
14
  /** Listen first, then drain. There is no timer that asks an idle machine for work. */
13
15
  export declare function createAutomationMachineRunner(options: AutomationMachineRunnerOptions): Readonly<{
@@ -9,6 +9,18 @@ export function createAutomationMachineRunner(options) {
9
9
  let listening = null;
10
10
  let draining = null;
11
11
  let pending = false;
12
+ // A claimed run executing here is work running here, so its count is runtime activity.
13
+ let running = 0;
14
+ const execute = async (run) => {
15
+ options.activity?.(++running);
16
+ try {
17
+ await options.execute(run);
18
+ }
19
+ finally {
20
+ options.activity?.(--running);
21
+ }
22
+ };
23
+ options.activity?.(running);
12
24
  const wake = (connection, signal) => {
13
25
  pending = true;
14
26
  if (draining)
@@ -19,7 +31,7 @@ export function createAutomationMachineRunner(options) {
19
31
  const runs = await options.runs.claim({ limit: batchSize, leaseSeconds });
20
32
  if (runs.length)
21
33
  options.log?.('automations.claimed', { count: runs.length });
22
- const settled = await Promise.allSettled(runs.map(options.execute));
34
+ const settled = await Promise.allSettled(runs.map(execute));
23
35
  for (const result of settled) {
24
36
  if (result.status === 'rejected')
25
37
  options.log?.('automations.run.failed', { error: safe(result.reason) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/automations",
3
- "version": "0.4.4-main.37557337400",
3
+ "version": "0.4.4-main.39177734548",
4
4
  "description": "Amalgm's automation SDK: durable trigger admission and target-machine execution.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "node": ">=24"
66
66
  },
67
67
  "dependencies": {
68
- "@amalgm/core": "0.5.1-main.37556559840",
68
+ "@amalgm/core": "0.5.1-main.39177162099",
69
69
  "@modelcontextprotocol/sdk": "^1.30.0",
70
70
  "@supabase/supabase-js": "2.57.4",
71
71
  "cron-parser": "^5.4.0",
@@ -108,11 +108,11 @@
108
108
  "@amalgm/core"
109
109
  ]
110
110
  },
111
- "gitHead": "8b44321c7ba41f6ac7aecbd65db06fc44b3803ce",
111
+ "gitHead": "4669872401fc7722068b08ea491af6c526a36889",
112
112
  "amalgmSource": {
113
113
  "repository": "amalgm-inc/amalgm-automations",
114
114
  "branch": "main",
115
- "commit": "8b44321c7ba41f6ac7aecbd65db06fc44b3803ce",
116
- "occurrence": "37557337400"
115
+ "commit": "4669872401fc7722068b08ea491af6c526a36889",
116
+ "occurrence": "39177734548"
117
117
  }
118
118
  }
@@ -64,8 +64,8 @@ input.
64
64
  - Omit `targetId` in a machine-bound session. Never guess or copy an opaque
65
65
  target id. If the principal has multiple targets, let the service require an
66
66
  explicit user choice.
67
- - A process `cwd`, when supplied, must be absolute. If omitted, the selected
68
- machine uses its documented default (normally that user's OS home).
67
+ - A process `cwd`, when supplied, must be absolute. If omitted, the step runs
68
+ in that user's Workspaces folder on the selected machine.
69
69
  - Workflow `env` is persisted ordinary configuration, not a secret store.
70
70
  Never place Shell credentials or reusable service secrets in it.
71
71
  - Use `--stdin` for CLI payloads containing a webhook signing secret or
@@ -84,10 +84,9 @@ authorized connecting this computer. Do not invent a code, run a code-less
84
84
  `install.sh`, or use sudo as an automatic workaround. Keep the code private
85
85
  to this setup session.
86
86
 
87
- The web installer places Shell under
88
- `~/.amalgm/runtime-packages/shell/<installed-version>/bin/amalgm` on macOS/Linux.
89
- If it is absent from PATH, use the exact launcher/version identified by the
90
- installer or app, not whichever version directory happens to sort last.
87
+ If `amalgm` is absent from PATH after the web installer runs, use the exact
88
+ launcher identified by the installer or app. Do not pick a runtime by sorting
89
+ version folders.
91
90
 
92
91
  ## Sign in and connect the computer
93
92