@gracefultools/astrid-sdk 0.8.2 → 1.0.1
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/README.md +173 -127
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +41 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +361 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +89 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +216 -0
- package/dist/client.js.map +1 -0
- package/dist/config/api-base.d.ts +21 -0
- package/dist/config/api-base.d.ts.map +1 -0
- package/dist/config/api-base.js +41 -0
- package/dist/config/api-base.js.map +1 -0
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -57
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +103 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/verdict.d.ts +88 -0
- package/dist/verdict.d.ts.map +1 -0
- package/dist/verdict.js +90 -0
- package/dist/verdict.js.map +1 -0
- package/package.json +56 -65
- package/dist/adapters/astrid-oauth.d.ts +0 -114
- package/dist/adapters/astrid-oauth.d.ts.map +0 -1
- package/dist/adapters/astrid-oauth.js +0 -287
- package/dist/adapters/astrid-oauth.js.map +0 -1
- package/dist/channel/channel.d.ts +0 -33
- package/dist/channel/channel.d.ts.map +0 -1
- package/dist/channel/channel.js +0 -90
- package/dist/channel/channel.js.map +0 -1
- package/dist/channel/index.d.ts +0 -13
- package/dist/channel/index.d.ts.map +0 -1
- package/dist/channel/index.js +0 -23
- package/dist/channel/index.js.map +0 -1
- package/dist/channel/message-formatter.d.ts +0 -14
- package/dist/channel/message-formatter.d.ts.map +0 -1
- package/dist/channel/message-formatter.js +0 -71
- package/dist/channel/message-formatter.js.map +0 -1
- package/dist/channel/oauth-client.d.ts +0 -15
- package/dist/channel/oauth-client.d.ts.map +0 -1
- package/dist/channel/oauth-client.js +0 -45
- package/dist/channel/oauth-client.js.map +0 -1
- package/dist/channel/rest-client.d.ts +0 -16
- package/dist/channel/rest-client.d.ts.map +0 -1
- package/dist/channel/rest-client.js +0 -66
- package/dist/channel/rest-client.js.map +0 -1
- package/dist/channel/session-mapper.d.ts +0 -14
- package/dist/channel/session-mapper.d.ts.map +0 -1
- package/dist/channel/session-mapper.js +0 -37
- package/dist/channel/session-mapper.js.map +0 -1
- package/dist/channel/sse-client.d.ts +0 -33
- package/dist/channel/sse-client.d.ts.map +0 -1
- package/dist/channel/sse-client.js +0 -204
- package/dist/channel/sse-client.js.map +0 -1
- package/dist/channel/types.d.ts +0 -65
- package/dist/channel/types.d.ts.map +0 -1
- package/dist/channel/types.js +0 -3
- package/dist/channel/types.js.map +0 -1
- package/dist/config/agent-workflow.d.ts +0 -78
- package/dist/config/agent-workflow.d.ts.map +0 -1
- package/dist/config/agent-workflow.js +0 -217
- package/dist/config/agent-workflow.js.map +0 -1
- package/dist/config/index.d.ts +0 -194
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -284
- package/dist/config/index.js.map +0 -1
- package/dist/deploy/vercel.d.ts +0 -27
- package/dist/deploy/vercel.d.ts.map +0 -1
- package/dist/deploy/vercel.js +0 -268
- package/dist/deploy/vercel.js.map +0 -1
- package/dist/types/index.d.ts +0 -157
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
- package/dist/utils/agent-config.d.ts +0 -56
- package/dist/utils/agent-config.d.ts.map +0 -1
- package/dist/utils/agent-config.js +0 -138
- package/dist/utils/agent-config.js.map +0 -1
- package/templates/.astrid.config.json +0 -60
- package/templates/ASTRID.template.md +0 -74
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is there anything for the scheduled loop to do? Decided here, where it can
|
|
3
|
+
* be tested; `astrid-agent queue` and astrid-web's
|
|
4
|
+
* `scripts/agent-queue-status.ts` only fetch and print. (Moved from
|
|
5
|
+
* astrid-web's scripts/lib/agent-queue-verdict.ts in AWTD-1691, which now
|
|
6
|
+
* re-exports this file.)
|
|
7
|
+
*
|
|
8
|
+
* WHY THE VERDICT IS MORE THAN `empty`. The endpoint's `empty` flag describes
|
|
9
|
+
* the Ready queue and nothing else. The run is also required to act on
|
|
10
|
+
* `attention` — comments and list-chat replies nobody has answered (AWTD-963).
|
|
11
|
+
* On 2026-09-20 the loop skipped past two direct questions from Jon, "nothing
|
|
12
|
+
* queued", because it only ever read `empty`.
|
|
13
|
+
*
|
|
14
|
+
* (It also used to wake on the client-side lane sweep's RECHECK/REVIEW items.
|
|
15
|
+
* The server settles Waiting now — astrid-core's waiting rules — so a task that
|
|
16
|
+
* wakes simply arrives in the queue.)
|
|
17
|
+
*
|
|
18
|
+
* WHY WAKING IS BOUNDED. "Token efficient" means a quiet tick is free AND a
|
|
19
|
+
* noisy one is bounded. An inbox item the agent decides not to answer — the
|
|
20
|
+
* "thanks" — would otherwise wake a session every half hour until the heat
|
|
21
|
+
* death of the subscription. So each wake-able thing has a key (the comment or
|
|
22
|
+
* message id), the loop records the
|
|
23
|
+
* keys it has run for, and a key wakes at most one run. A NEW comment is a new
|
|
24
|
+
* key and wakes another. The queue itself is exempt: a Ready task is work
|
|
25
|
+
* until someone moves it, and the claim protocol already bounds that.
|
|
26
|
+
*/
|
|
27
|
+
export interface QueueSnapshotTask {
|
|
28
|
+
id: string;
|
|
29
|
+
identifier?: string | null;
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Carries the LONG-RUN flag (AWTD-1041, scripts/lib/long-run.ts). */
|
|
32
|
+
description?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface AttentionSnapshot {
|
|
35
|
+
tasks: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
identifier?: string | null;
|
|
38
|
+
title?: string;
|
|
39
|
+
lastComment: {
|
|
40
|
+
id: string;
|
|
41
|
+
excerpt?: string;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
messages: Array<{
|
|
45
|
+
id: string;
|
|
46
|
+
content?: string;
|
|
47
|
+
}>;
|
|
48
|
+
truncated?: boolean;
|
|
49
|
+
skipped?: string[];
|
|
50
|
+
}
|
|
51
|
+
/** The subset of `GET /api/v1/agent-queue` the verdict reads. */
|
|
52
|
+
export interface QueueSnapshot {
|
|
53
|
+
empty: boolean;
|
|
54
|
+
queue: QueueSnapshotTask[];
|
|
55
|
+
held?: {
|
|
56
|
+
notDueCount?: number;
|
|
57
|
+
notReadyCount?: number;
|
|
58
|
+
scheduled?: Array<{
|
|
59
|
+
id: string;
|
|
60
|
+
title: string;
|
|
61
|
+
startsAt: string;
|
|
62
|
+
}>;
|
|
63
|
+
};
|
|
64
|
+
/** Absent on a response that predates AWTD-963, or when the token could not read it. */
|
|
65
|
+
attention?: AttentionSnapshot | null;
|
|
66
|
+
hint?: string;
|
|
67
|
+
}
|
|
68
|
+
export type QueueVerdictReason = 'queue' | 'inbox' | 'idle';
|
|
69
|
+
export interface QueueVerdict {
|
|
70
|
+
/** Start a session? */
|
|
71
|
+
work: boolean;
|
|
72
|
+
reason: QueueVerdictReason;
|
|
73
|
+
/** The one `QUEUE:` line the loop's log keeps. */
|
|
74
|
+
line: string;
|
|
75
|
+
/**
|
|
76
|
+
* Every wake-able key present right now — what the caller records as seen
|
|
77
|
+
* once this tick is decided. It is the CURRENT set, not an accumulation, so
|
|
78
|
+
* an answered comment drops out and the file prunes itself.
|
|
79
|
+
*/
|
|
80
|
+
keys: string[];
|
|
81
|
+
}
|
|
82
|
+
/** Each thing that may wake a run, as a stable key. Order is deterministic for the file. */
|
|
83
|
+
export declare function wakeKeys(snapshot: QueueSnapshot): string[];
|
|
84
|
+
export declare function decideQueueVerdict({ snapshot, seen, }: {
|
|
85
|
+
snapshot: QueueSnapshot;
|
|
86
|
+
seen: ReadonlySet<string>;
|
|
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C,CAAA;KACnE,CAAA;IACD,wFAAwF;IACxF,SAAS,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAE3D,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,kBAAkB,CAAA;IAC1B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,CAS1D;AAUD,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,aAAa,CAAA;IACvB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC1B,GAAG,YAAY,CAkDf"}
|
package/dist/verdict.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Is there anything for the scheduled loop to do? Decided here, where it can
|
|
4
|
+
* be tested; `astrid-agent queue` and astrid-web's
|
|
5
|
+
* `scripts/agent-queue-status.ts` only fetch and print. (Moved from
|
|
6
|
+
* astrid-web's scripts/lib/agent-queue-verdict.ts in AWTD-1691, which now
|
|
7
|
+
* re-exports this file.)
|
|
8
|
+
*
|
|
9
|
+
* WHY THE VERDICT IS MORE THAN `empty`. The endpoint's `empty` flag describes
|
|
10
|
+
* the Ready queue and nothing else. The run is also required to act on
|
|
11
|
+
* `attention` — comments and list-chat replies nobody has answered (AWTD-963).
|
|
12
|
+
* On 2026-09-20 the loop skipped past two direct questions from Jon, "nothing
|
|
13
|
+
* queued", because it only ever read `empty`.
|
|
14
|
+
*
|
|
15
|
+
* (It also used to wake on the client-side lane sweep's RECHECK/REVIEW items.
|
|
16
|
+
* The server settles Waiting now — astrid-core's waiting rules — so a task that
|
|
17
|
+
* wakes simply arrives in the queue.)
|
|
18
|
+
*
|
|
19
|
+
* WHY WAKING IS BOUNDED. "Token efficient" means a quiet tick is free AND a
|
|
20
|
+
* noisy one is bounded. An inbox item the agent decides not to answer — the
|
|
21
|
+
* "thanks" — would otherwise wake a session every half hour until the heat
|
|
22
|
+
* death of the subscription. So each wake-able thing has a key (the comment or
|
|
23
|
+
* message id), the loop records the
|
|
24
|
+
* keys it has run for, and a key wakes at most one run. A NEW comment is a new
|
|
25
|
+
* key and wakes another. The queue itself is exempt: a Ready task is work
|
|
26
|
+
* until someone moves it, and the claim protocol already bounds that.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.wakeKeys = wakeKeys;
|
|
30
|
+
exports.decideQueueVerdict = decideQueueVerdict;
|
|
31
|
+
/** Each thing that may wake a run, as a stable key. Order is deterministic for the file. */
|
|
32
|
+
function wakeKeys(snapshot) {
|
|
33
|
+
const keys = [];
|
|
34
|
+
for (const task of snapshot.attention?.tasks ?? []) {
|
|
35
|
+
keys.push(`comment:${task.id}:${task.lastComment.id}`);
|
|
36
|
+
}
|
|
37
|
+
for (const message of snapshot.attention?.messages ?? []) {
|
|
38
|
+
keys.push(`message:${message.id}`);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function plural(n, singular, pluralForm = `${singular}s`) {
|
|
43
|
+
return `${n} ${n === 1 ? singular : pluralForm}`;
|
|
44
|
+
}
|
|
45
|
+
function label(task) {
|
|
46
|
+
return task.identifier ?? task.id;
|
|
47
|
+
}
|
|
48
|
+
function decideQueueVerdict({ snapshot, seen, }) {
|
|
49
|
+
const keys = wakeKeys(snapshot);
|
|
50
|
+
// 1. The queue. Never deduplicated: a Ready task is work until it moves.
|
|
51
|
+
if (snapshot.queue.length > 0) {
|
|
52
|
+
return {
|
|
53
|
+
work: true,
|
|
54
|
+
reason: 'queue',
|
|
55
|
+
line: `QUEUE: ${plural(snapshot.queue.length, 'task')} ready`,
|
|
56
|
+
keys,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// 2. The inbox — only what this loop has not already run for.
|
|
60
|
+
const attention = snapshot.attention;
|
|
61
|
+
const newComments = (attention?.tasks ?? []).filter(task => !seen.has(`comment:${task.id}:${task.lastComment.id}`));
|
|
62
|
+
const newMessages = (attention?.messages ?? []).filter(message => !seen.has(`message:${message.id}`));
|
|
63
|
+
if (newComments.length > 0 || newMessages.length > 0) {
|
|
64
|
+
const parts = [];
|
|
65
|
+
if (newComments.length > 0) {
|
|
66
|
+
parts.push(`${plural(newComments.length, 'unanswered comment')} (${newComments.map(label).join(', ')})`);
|
|
67
|
+
}
|
|
68
|
+
if (newMessages.length > 0) {
|
|
69
|
+
parts.push(plural(newMessages.length, 'unanswered list-chat message'));
|
|
70
|
+
}
|
|
71
|
+
return { work: true, reason: 'inbox', line: `QUEUE: empty — ${parts.join('; ')}`, keys };
|
|
72
|
+
}
|
|
73
|
+
// 3. Idle. Say why, the way the log already reads, and name what was NOT
|
|
74
|
+
// read: an unread inbox and a quiet one are different facts.
|
|
75
|
+
const next = snapshot.held?.scheduled?.[0];
|
|
76
|
+
let line = next
|
|
77
|
+
? `QUEUE: empty — next task ("${next.title}") comes due ${next.startsAt}`
|
|
78
|
+
: `QUEUE: empty${snapshot.hint ? ` — ${snapshot.hint}` : ''}`;
|
|
79
|
+
const notes = [];
|
|
80
|
+
const muted = (attention?.tasks.length ?? 0) + (attention?.messages.length ?? 0);
|
|
81
|
+
if (muted > 0) {
|
|
82
|
+
notes.push(`${plural(muted, 'unanswered item')} already woke a run; a new comment wakes another`);
|
|
83
|
+
}
|
|
84
|
+
if (!attention)
|
|
85
|
+
notes.push('inbox not read');
|
|
86
|
+
if (notes.length > 0)
|
|
87
|
+
line += ` [${notes.join('; ')}]`;
|
|
88
|
+
return { work: false, reason: 'idle', line, keys };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=verdict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict.js","sourceRoot":"","sources":["../src/verdict.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;AAqDH,4BASC;AAUD,gDAwDC;AA5ED,4FAA4F;AAC5F,SAAgB,QAAQ,CAAC,QAAuB;IAC9C,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAA;IACxD,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,SAAS,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IACpC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,MAAM,CAAC,CAAS,EAAE,QAAgB,EAAE,UAAU,GAAG,GAAG,QAAQ,GAAG;IACtE,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;AAClD,CAAC;AAED,SAAS,KAAK,CAAC,IAAgD;IAC7D,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,EAAE,CAAA;AACnC,CAAC;AAED,SAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,IAAI,GAIL;IACC,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAE/B,yEAAyE;IACzE,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CA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
"description": "Astrid
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"typescript":
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"publishConfig": {
|
|
58
|
-
"access": "public"
|
|
59
|
-
},
|
|
60
|
-
"devDependencies": {
|
|
61
|
-
"@types/node": "^20.0.0",
|
|
62
|
-
"typescript": "^5.0.0",
|
|
63
|
-
"vitest": "^3.2.4"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@gracefultools/astrid-sdk",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Astrid agent runner: the astrid-agent command (queue, claim, release) and a typed REST client for the agent endpoints",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"astrid-agent": "dist/bin.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"dev": "tsc --watch",
|
|
24
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
25
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"astrid",
|
|
31
|
+
"agent",
|
|
32
|
+
"runner",
|
|
33
|
+
"task-queue",
|
|
34
|
+
"cli",
|
|
35
|
+
"automation"
|
|
36
|
+
],
|
|
37
|
+
"author": "Astrid",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/Graceful-Tools/astrid-web.git",
|
|
42
|
+
"directory": "packages/astrid-sdk"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://astrid.cc",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^20.0.0",
|
|
53
|
+
"typescript": "^5.0.0",
|
|
54
|
+
"vitest": "^4.1.11"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Astrid OAuth API Client
|
|
3
|
-
*
|
|
4
|
-
* Client for accessing Astrid tasks via OAuth 2.0 Client Credentials flow
|
|
5
|
-
*/
|
|
6
|
-
import type { AstridTask, AstridList } from '../types/index.js';
|
|
7
|
-
interface APIResponse<T = unknown> {
|
|
8
|
-
success: boolean;
|
|
9
|
-
data?: T;
|
|
10
|
-
error?: string;
|
|
11
|
-
}
|
|
12
|
-
interface Comment {
|
|
13
|
-
id: string;
|
|
14
|
-
content: string;
|
|
15
|
-
createdAt: string;
|
|
16
|
-
authorId: string;
|
|
17
|
-
authorEmail?: string;
|
|
18
|
-
}
|
|
19
|
-
interface CreateTaskData {
|
|
20
|
-
title: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
priority?: number;
|
|
23
|
-
listId?: string;
|
|
24
|
-
dueDateTime?: string;
|
|
25
|
-
}
|
|
26
|
-
interface UpdateTaskData {
|
|
27
|
-
title?: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
priority?: number;
|
|
30
|
-
isCompleted?: boolean;
|
|
31
|
-
dueDateTime?: string;
|
|
32
|
-
assigneeId?: string | null;
|
|
33
|
-
}
|
|
34
|
-
export interface AstridOAuthConfig {
|
|
35
|
-
baseUrl?: string;
|
|
36
|
-
clientId?: string;
|
|
37
|
-
clientSecret?: string;
|
|
38
|
-
}
|
|
39
|
-
export declare class AstridOAuthClient {
|
|
40
|
-
private readonly baseUrl;
|
|
41
|
-
private readonly clientId;
|
|
42
|
-
private readonly clientSecret;
|
|
43
|
-
private accessToken;
|
|
44
|
-
private tokenExpiry;
|
|
45
|
-
constructor(config?: AstridOAuthConfig);
|
|
46
|
-
/**
|
|
47
|
-
* Check if the client is properly configured
|
|
48
|
-
*/
|
|
49
|
-
isConfigured(): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Obtain an access token using client credentials flow
|
|
52
|
-
*/
|
|
53
|
-
private obtainAccessToken;
|
|
54
|
-
/**
|
|
55
|
-
* Make an authenticated API request
|
|
56
|
-
*/
|
|
57
|
-
private makeRequest;
|
|
58
|
-
/**
|
|
59
|
-
* Get all lists accessible to the authenticated user
|
|
60
|
-
*/
|
|
61
|
-
getLists(): Promise<APIResponse<AstridList[]>>;
|
|
62
|
-
/**
|
|
63
|
-
* Get a specific list by ID
|
|
64
|
-
*/
|
|
65
|
-
getList(listId: string): Promise<APIResponse<AstridList>>;
|
|
66
|
-
/**
|
|
67
|
-
* Get all tasks, optionally filtered by list
|
|
68
|
-
*/
|
|
69
|
-
getTasks(listId?: string, includeCompleted?: boolean): Promise<APIResponse<AstridTask[]>>;
|
|
70
|
-
/**
|
|
71
|
-
* Get a specific task by ID with comments
|
|
72
|
-
*/
|
|
73
|
-
getTask(taskId: string): Promise<APIResponse<AstridTask>>;
|
|
74
|
-
/**
|
|
75
|
-
* Get comments for a task
|
|
76
|
-
*/
|
|
77
|
-
getComments(taskId: string): Promise<APIResponse<Comment[]>>;
|
|
78
|
-
/**
|
|
79
|
-
* Create a new task
|
|
80
|
-
*/
|
|
81
|
-
createTask(taskData: CreateTaskData): Promise<APIResponse<AstridTask>>;
|
|
82
|
-
/**
|
|
83
|
-
* Update an existing task
|
|
84
|
-
*/
|
|
85
|
-
updateTask(taskId: string, updates: UpdateTaskData): Promise<APIResponse<AstridTask>>;
|
|
86
|
-
/**
|
|
87
|
-
* Mark a task as complete
|
|
88
|
-
*/
|
|
89
|
-
completeTask(taskId: string): Promise<APIResponse<AstridTask>>;
|
|
90
|
-
/**
|
|
91
|
-
* Reassign a task to a different user
|
|
92
|
-
* @param taskId - The task ID
|
|
93
|
-
* @param assigneeId - The user ID to assign to, or null to unassign
|
|
94
|
-
*/
|
|
95
|
-
reassignTask(taskId: string, assigneeId: string | null): Promise<APIResponse<AstridTask>>;
|
|
96
|
-
/**
|
|
97
|
-
* Add a comment to a task
|
|
98
|
-
* @param taskId - The task ID to add the comment to
|
|
99
|
-
* @param content - The comment content
|
|
100
|
-
* @param aiAgentId - Optional AI agent user ID to post the comment as
|
|
101
|
-
*/
|
|
102
|
-
addComment(taskId: string, content: string, aiAgentId?: string): Promise<APIResponse<Comment>>;
|
|
103
|
-
/**
|
|
104
|
-
* Get AI agent user ID by email
|
|
105
|
-
* Used to post comments as the AI agent instead of the OAuth client owner
|
|
106
|
-
*/
|
|
107
|
-
getAgentIdByEmail(email: string): Promise<string | null>;
|
|
108
|
-
/**
|
|
109
|
-
* Test the connection to the API
|
|
110
|
-
*/
|
|
111
|
-
testConnection(): Promise<APIResponse>;
|
|
112
|
-
}
|
|
113
|
-
export type { APIResponse, Comment, CreateTaskData, UpdateTaskData };
|
|
114
|
-
//# sourceMappingURL=astrid-oauth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astrid-oauth.d.ts","sourceRoot":"","sources":["../../src/adapters/astrid-oauth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAS/D,UAAU,WAAW,CAAC,CAAC,GAAG,OAAO;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,CAAC,CAAA;IACR,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WA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