@forwardimpact/outpost 3.3.4 → 3.5.0
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/LICENSE +21 -201
- package/config/skill-postures.json +28 -0
- package/package.json +2 -4
- package/src/agent-path.js +42 -0
- package/src/agent-runner.js +60 -17
- package/src/kb-manager.js +5 -7
- package/src/outpost.js +43 -1
- package/src/posture.js +77 -0
- package/src/socket-server.js +15 -6
- package/src/spawn-env.js +62 -0
- package/src/state-manager.js +17 -2
- package/templates/.claude/agents/chief-of-staff.md +24 -9
- package/templates/.claude/agents/concierge.md +14 -0
- package/templates/.claude/agents/head-hunter.md +14 -0
- package/templates/.claude/agents/librarian.md +19 -7
- package/templates/.claude/agents/postman.md +14 -0
- package/templates/.claude/agents/recruiter.md +21 -12
- package/templates/.claude/settings.json +4 -0
- package/templates/.claude/skills/anarlog-follow/SKILL.md +7 -7
- package/templates/.claude/skills/anarlog-process/SKILL.md +15 -16
- package/templates/.claude/skills/anarlog-process/references/extraction.md +5 -5
- package/templates/.claude/skills/candidate-report/SKILL.md +9 -9
- package/templates/.claude/skills/deck-create/SKILL.md +2 -2
- package/templates/.claude/skills/deck-summarize/SKILL.md +2 -2
- package/templates/.claude/skills/deck-summarize/references/brief-template.md +1 -1
- package/templates/.claude/skills/doc-collab/SKILL.md +8 -8
- package/templates/.claude/skills/doc-create/SKILL.md +3 -3
- package/templates/.claude/skills/draft-emails/SKILL.md +19 -19
- package/templates/.claude/skills/draft-emails/references/template.md +1 -1
- package/templates/.claude/skills/draft-emails/scripts/scan-emails.mjs +4 -4
- package/templates/.claude/skills/draft-emails/scripts/send-email.mjs +2 -2
- package/templates/.claude/skills/extract-entities/SKILL.md +16 -17
- package/templates/.claude/skills/extract-entities/references/TEMPLATES.md +2 -2
- package/templates/.claude/skills/extract-entities/references/conditions.md +4 -4
- package/templates/.claude/skills/extract-entities/references/links.md +3 -18
- package/templates/.claude/skills/extract-entities/references/recruitment.md +8 -8
- package/templates/.claude/skills/extract-entities/references/resolution.md +3 -5
- package/templates/.claude/skills/extract-entities/references/sources.md +1 -1
- package/templates/.claude/skills/extract-entities/references/templates-conditions.md +2 -2
- package/templates/.claude/skills/extract-entities/references/templates-priorities.md +32 -0
- package/templates/.claude/skills/extract-entities/references/templates-projects-topics.md +2 -2
- package/templates/.claude/skills/meeting-prep/SKILL.md +18 -19
- package/templates/.claude/skills/req-assess/SKILL.md +11 -11
- package/templates/.claude/skills/req-assess/references/interview-template.md +1 -1
- package/templates/.claude/skills/req-assess/references/panel-template.md +1 -1
- package/templates/.claude/skills/req-decide/SKILL.md +17 -17
- package/templates/.claude/skills/req-decide/references/template.md +1 -1
- package/templates/.claude/skills/req-forget/SKILL.md +8 -8
- package/templates/.claude/skills/req-forget/references/classify.md +4 -4
- package/templates/.claude/skills/req-forget/references/locations.md +10 -10
- package/templates/.claude/skills/req-forget/references/report-template.md +8 -8
- package/templates/.claude/skills/req-scan/SKILL.md +3 -3
- package/templates/.claude/skills/req-scan/references/template.md +1 -1
- package/templates/.claude/skills/req-screen/SKILL.md +9 -9
- package/templates/.claude/skills/req-screen/references/template.md +1 -1
- package/templates/.claude/skills/req-track/SKILL.md +17 -17
- package/templates/.claude/skills/req-track/references/fields.md +8 -8
- package/templates/.claude/skills/req-track/references/signals.md +2 -2
- package/templates/.claude/skills/req-track/references/templates.md +1 -1
- package/templates/.claude/skills/req-workday/SKILL.md +12 -12
- package/templates/.claude/skills/req-workday/references/templates.md +3 -3
- package/templates/.claude/skills/send-chat/SKILL.md +4 -4
- package/templates/.claude/skills/upstream-instructions/SKILL.md +154 -0
- package/templates/.claude/skills/upstream-instructions/references/examples.md +97 -0
- package/templates/CLAUDE.md +47 -53
- package/templates/.claude/skills/extract-entities/references/templates-goals-priorities.md +0 -63
- package/templates/.claude/skills/upstream-skill/SKILL.md +0 -130
- package/templates/.claude/skills/upstream-skill/references/examples.md +0 -80
- package/templates/knowledge/Briefings/.gitkeep +0 -0
package/LICENSE
CHANGED
|
@@ -1,201 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2026 Dick Olsson
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Zachary Rice
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"candidate-report": "draft",
|
|
3
|
+
"deck-create": "draft",
|
|
4
|
+
"deck-summarize": "brief",
|
|
5
|
+
"doc-collab": "brief",
|
|
6
|
+
"doc-create": "draft",
|
|
7
|
+
"draft-emails": "draft",
|
|
8
|
+
"extract-entities": "brief",
|
|
9
|
+
"hyprnote-follow": "brief",
|
|
10
|
+
"hyprnote-process": "brief",
|
|
11
|
+
"hyprnote-trim": "brief",
|
|
12
|
+
"manage-tasks": "brief",
|
|
13
|
+
"meeting-prep": "brief",
|
|
14
|
+
"organize-files": "draft",
|
|
15
|
+
"req-assess": "brief",
|
|
16
|
+
"req-decide": "brief",
|
|
17
|
+
"req-forget": "brief",
|
|
18
|
+
"req-scan": "brief",
|
|
19
|
+
"req-screen": "brief",
|
|
20
|
+
"req-track": "brief",
|
|
21
|
+
"req-workday": "brief",
|
|
22
|
+
"send-chat": "draft",
|
|
23
|
+
"sync-apple-calendar": "brief",
|
|
24
|
+
"sync-apple-mail": "brief",
|
|
25
|
+
"sync-teams": "brief",
|
|
26
|
+
"upstream-skill": "brief",
|
|
27
|
+
"weekly-update": "brief"
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forwardimpact/outpost",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Personal operations center — context from email, calendar, and knowledge assembled so preparation is continuous, not a morning scramble.",
|
|
5
5
|
"homepage": "https://www.forwardimpact.team",
|
|
6
6
|
"repository": {
|
|
@@ -45,9 +45,7 @@
|
|
|
45
45
|
"scripts": {
|
|
46
46
|
"start": "bun ./bin/fit-outpost.js",
|
|
47
47
|
"status": "bun ./bin/fit-outpost.js status",
|
|
48
|
-
"build": "bun pkg/build.js"
|
|
49
|
-
"build:app": "bun pkg/build.js --app",
|
|
50
|
-
"build:pkg": "bun pkg/build.js --pkg"
|
|
48
|
+
"build": "bun pkg/build.js"
|
|
51
49
|
},
|
|
52
50
|
"dependencies": {
|
|
53
51
|
"@forwardimpact/libcli": "^0.1.0",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-path — validate a config-supplied agent name before using it as a
|
|
3
|
+
* filesystem path component.
|
|
4
|
+
*
|
|
5
|
+
* The agent-state writer maps an agent name to a per-agent state filename.
|
|
6
|
+
* A name carrying `/` or `..` segments would let a rewritten `scheduler.json`
|
|
7
|
+
* direct writes outside `~/.cache/fit/outpost/state/`. This module validates
|
|
8
|
+
* and rejects rather than silently sanitising, so an unexpected path segment
|
|
9
|
+
* surfaces as an intrusion signal instead of a quietly rewritten filename.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Raised when an agent name cannot map to a safe state-file prefix. */
|
|
13
|
+
export class UnsafeAgentNameError extends Error {
|
|
14
|
+
/** @param {string} name */
|
|
15
|
+
constructor(name) {
|
|
16
|
+
super(`unsafe agent name for state path: ${JSON.stringify(name)}`);
|
|
17
|
+
this.name = "UnsafeAgentNameError";
|
|
18
|
+
this.agentName = name;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Map an agent name to a safe state-file prefix (hyphen → underscore).
|
|
24
|
+
* @param {string} name
|
|
25
|
+
* @returns {string} safe filename prefix
|
|
26
|
+
* @throws {UnsafeAgentNameError} when `name` is empty, non-string, or contains
|
|
27
|
+
* `/`, `\`, `..`, NUL, or a leading `~`.
|
|
28
|
+
*/
|
|
29
|
+
export function agentNameToStatePrefix(name) {
|
|
30
|
+
if (
|
|
31
|
+
typeof name !== "string" ||
|
|
32
|
+
name.length === 0 ||
|
|
33
|
+
name.includes("/") ||
|
|
34
|
+
name.includes("\\") ||
|
|
35
|
+
name.includes("..") ||
|
|
36
|
+
name.includes("\0") ||
|
|
37
|
+
name.startsWith("~")
|
|
38
|
+
) {
|
|
39
|
+
throw new UnsafeAgentNameError(String(name));
|
|
40
|
+
}
|
|
41
|
+
return name.replace(/-/g, "_");
|
|
42
|
+
}
|
package/src/agent-runner.js
CHANGED
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
import { resolve, join } from "node:path";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
import { isoTimestamp } from "@forwardimpact/libutil";
|
|
8
|
+
import {
|
|
9
|
+
readPosture,
|
|
10
|
+
effectivePosture,
|
|
11
|
+
loadManifest,
|
|
12
|
+
draftSkills,
|
|
13
|
+
} from "./posture.js";
|
|
14
|
+
import { buildSpawnEnv } from "./spawn-env.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* System-prompt directive injected under the `brief` posture. Neutralises any
|
|
18
|
+
* draft-side prose in a materialised agent definition and forbids writing the
|
|
19
|
+
* posture record.
|
|
20
|
+
*/
|
|
21
|
+
const BRIEF_DIRECTIVE =
|
|
22
|
+
"Adoption posture: brief. Run only read-and-brief work. Do not draft or " +
|
|
23
|
+
"send content on the user's behalf for delivery to anyone else, do not move " +
|
|
24
|
+
"or write files outside the knowledge base, and never write the posture " +
|
|
25
|
+
"record (~/.fit/outpost/posture.json).";
|
|
8
26
|
|
|
9
27
|
/** Spawn agent CLI processes, capture their output, and update agent state. */
|
|
10
28
|
export class AgentRunner {
|
|
@@ -17,6 +35,8 @@ export class AgentRunner {
|
|
|
17
35
|
#proc;
|
|
18
36
|
#clock;
|
|
19
37
|
#runtime;
|
|
38
|
+
#posturePath;
|
|
39
|
+
#manifestPath;
|
|
20
40
|
|
|
21
41
|
/**
|
|
22
42
|
* @param {Object | (() => Object | Promise<{default?: Object}>)} spawn -
|
|
@@ -28,8 +48,11 @@ export class AgentRunner {
|
|
|
28
48
|
* @param {string} cacheDir - Cache directory for state files
|
|
29
49
|
* @param {import("@forwardimpact/libutil/runtime").Runtime} runtime
|
|
30
50
|
* Injected runtime bag (uses `fs` (async), `proc`, `clock`).
|
|
51
|
+
* @param {{posturePath: string, manifestPath: string}} posture - Paths to the
|
|
52
|
+
* posture record (read-only on the wake path) and the skill-posture
|
|
53
|
+
* membership manifest.
|
|
31
54
|
*/
|
|
32
|
-
constructor(spawn, stateManager, logFn, cacheDir, runtime) {
|
|
55
|
+
constructor(spawn, stateManager, logFn, cacheDir, runtime, posture) {
|
|
33
56
|
if (!spawn) throw new Error("spawn is required");
|
|
34
57
|
if (!stateManager) throw new Error("stateManager is required");
|
|
35
58
|
if (!logFn) throw new Error("logFn is required");
|
|
@@ -37,6 +60,10 @@ export class AgentRunner {
|
|
|
37
60
|
if (!runtime?.fs) throw new Error("runtime.fs is required");
|
|
38
61
|
if (!runtime?.proc) throw new Error("runtime.proc is required");
|
|
39
62
|
if (!runtime?.clock) throw new Error("runtime.clock is required");
|
|
63
|
+
if (!posture?.posturePath)
|
|
64
|
+
throw new Error("posture.posturePath is required");
|
|
65
|
+
if (!posture?.manifestPath)
|
|
66
|
+
throw new Error("posture.manifestPath is required");
|
|
40
67
|
this.#spawn = spawn;
|
|
41
68
|
this.#stateManager = stateManager;
|
|
42
69
|
this.#log = logFn;
|
|
@@ -45,6 +72,8 @@ export class AgentRunner {
|
|
|
45
72
|
this.#proc = runtime.proc;
|
|
46
73
|
this.#clock = runtime.clock;
|
|
47
74
|
this.#runtime = runtime;
|
|
75
|
+
this.#posturePath = posture.posturePath;
|
|
76
|
+
this.#manifestPath = posture.manifestPath;
|
|
48
77
|
this.#activeChildren = new Set();
|
|
49
78
|
}
|
|
50
79
|
|
|
@@ -118,22 +147,25 @@ export class AgentRunner {
|
|
|
118
147
|
}
|
|
119
148
|
|
|
120
149
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
150
|
+
* Resolve the spawn flags the recorded posture adds. Under `brief` (also the
|
|
151
|
+
* default when no posture is recorded), deny every draft-side skill by name
|
|
152
|
+
* and inject the brief directive — a deterministic gate the woken agent
|
|
153
|
+
* cannot override under `bypassPermissions`. Under `brief+draft`, add
|
|
154
|
+
* nothing. The posture record is read here, never written.
|
|
155
|
+
* @returns {Promise<string[]>} Extra args to append to the spawn argv.
|
|
126
156
|
*/
|
|
127
|
-
#
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
157
|
+
async #postureArgs() {
|
|
158
|
+
const posture = effectivePosture(
|
|
159
|
+
await readPosture(this.#fs, this.#posturePath),
|
|
160
|
+
);
|
|
161
|
+
if (posture !== "brief") return [];
|
|
162
|
+
const manifest = await loadManifest(this.#fs, this.#manifestPath);
|
|
163
|
+
const denied = draftSkills(manifest)
|
|
164
|
+
.map((s) => `Skill(${s})`)
|
|
165
|
+
.join(" ");
|
|
166
|
+
const args = ["--append-system-prompt", BRIEF_DIRECTIVE];
|
|
167
|
+
if (denied) args.unshift("--disallowedTools", denied);
|
|
168
|
+
return args;
|
|
137
169
|
}
|
|
138
170
|
|
|
139
171
|
/**
|
|
@@ -170,11 +202,21 @@ export class AgentRunner {
|
|
|
170
202
|
"--agent",
|
|
171
203
|
agentName,
|
|
172
204
|
"--print",
|
|
205
|
+
...(await this.#postureArgs()),
|
|
173
206
|
"-p",
|
|
174
207
|
"Observe and act.",
|
|
175
208
|
];
|
|
176
209
|
|
|
177
|
-
const env =
|
|
210
|
+
const { env, rejections } = buildSpawnEnv(configEnv, this.#proc.env);
|
|
211
|
+
for (const key of rejections) {
|
|
212
|
+
this.#log(
|
|
213
|
+
JSON.stringify({
|
|
214
|
+
event: "outpost.spawn_env.rejected",
|
|
215
|
+
key,
|
|
216
|
+
agent: agentName,
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
219
|
+
}
|
|
178
220
|
const spawnMod = await this.#resolveSpawn();
|
|
179
221
|
|
|
180
222
|
try {
|
|
@@ -206,6 +248,7 @@ export class AgentRunner {
|
|
|
206
248
|
stdout,
|
|
207
249
|
agentName,
|
|
208
250
|
this.#cacheDir,
|
|
251
|
+
this.#log,
|
|
209
252
|
);
|
|
210
253
|
} else {
|
|
211
254
|
const errMsg = stderr || stdout || `Exit code ${exitCode}`;
|
package/src/kb-manager.js
CHANGED
|
@@ -179,13 +179,11 @@ export class KBManager {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
await this.#ensureDir(dest);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
"knowledge/Briefings",
|
|
188
|
-
])
|
|
182
|
+
// Create the top-level roots only. `Knowledge/` is the shared graph (synced
|
|
183
|
+
// with the team); `Drafts/` and `Briefings/` are personal and local. Entity
|
|
184
|
+
// subdirectories (People, Organizations, ...) are created on demand by the
|
|
185
|
+
// skills that write into them.
|
|
186
|
+
for (const d of ["Knowledge", "Drafts", "Briefings"])
|
|
189
187
|
await this.#ensureDir(join(dest, d));
|
|
190
188
|
|
|
191
189
|
await this.copyBundledFiles(templateDir, dest);
|
package/src/outpost.js
CHANGED
|
@@ -27,6 +27,13 @@ import { AgentRunner } from "./agent-runner.js";
|
|
|
27
27
|
import { Scheduler, formatLocalTime } from "./scheduler.js";
|
|
28
28
|
import { KBManager } from "./kb-manager.js";
|
|
29
29
|
import { SocketServer, requestShutdown } from "./socket-server.js";
|
|
30
|
+
import {
|
|
31
|
+
readPosture,
|
|
32
|
+
writePosture,
|
|
33
|
+
effectivePosture,
|
|
34
|
+
loadManifest,
|
|
35
|
+
POSTURES,
|
|
36
|
+
} from "./posture.js";
|
|
30
37
|
|
|
31
38
|
const SHARE_DIR = "/usr/local/share/fit-outpost";
|
|
32
39
|
|
|
@@ -65,6 +72,11 @@ function buildDefinition(version) {
|
|
|
65
72
|
},
|
|
66
73
|
{ name: "validate", description: "Validate agent definitions exist" },
|
|
67
74
|
{ name: "status", description: "Show agent status" },
|
|
75
|
+
{
|
|
76
|
+
name: "posture",
|
|
77
|
+
args: "[brief|brief+draft]",
|
|
78
|
+
description: "Show or set the adoption posture (brief or brief+draft)",
|
|
79
|
+
},
|
|
68
80
|
],
|
|
69
81
|
globalOptions: {
|
|
70
82
|
help: { type: "boolean", short: "h", description: "Show this help" },
|
|
@@ -147,10 +159,12 @@ export async function run(runtime, version) {
|
|
|
147
159
|
const OUTPOST_HOME = join(HOME, ".fit", "outpost");
|
|
148
160
|
const CONFIG_PATH = join(OUTPOST_HOME, "scheduler.json");
|
|
149
161
|
const STATE_PATH = join(OUTPOST_HOME, "state.json");
|
|
162
|
+
const POSTURE_PATH = join(OUTPOST_HOME, "posture.json");
|
|
150
163
|
const LOG_DIR = join(OUTPOST_HOME, "logs");
|
|
151
164
|
const CACHE_DIR = join(HOME, ".cache", "fit", "outpost");
|
|
152
165
|
const SOCKET_PATH = join(OUTPOST_HOME, "outpost.sock");
|
|
153
166
|
const PKG_DIR = dirname(import.meta.dirname);
|
|
167
|
+
const MANIFEST_PATH = join(PKG_DIR, "config", "skill-postures.json");
|
|
154
168
|
|
|
155
169
|
// --- Logging ---------------------------------------------------------------
|
|
156
170
|
await fs.mkdir(LOG_DIR, { recursive: true });
|
|
@@ -190,6 +204,7 @@ export async function run(runtime, version) {
|
|
|
190
204
|
log,
|
|
191
205
|
CACHE_DIR,
|
|
192
206
|
runtime,
|
|
207
|
+
{ posturePath: POSTURE_PATH, manifestPath: MANIFEST_PATH },
|
|
193
208
|
);
|
|
194
209
|
const scheduler = new Scheduler(
|
|
195
210
|
loadConfig,
|
|
@@ -333,7 +348,12 @@ export async function run(runtime, version) {
|
|
|
333
348
|
async function showStatus() {
|
|
334
349
|
const config = await loadConfig();
|
|
335
350
|
const state = await stateManager.load();
|
|
351
|
+
const posture = await readPosture(fs, POSTURE_PATH);
|
|
336
352
|
logger.info("\nOutpost Scheduler\n==================\n");
|
|
353
|
+
// The posture must be observable on a line matching
|
|
354
|
+
// `^posture: (brief|brief+draft|unset)$`, so write it as plain text to
|
|
355
|
+
// stdout rather than through the RFC5424-prefixed logger.
|
|
356
|
+
proc.stdout.write(`posture: ${posture ?? "unset"}\n`);
|
|
337
357
|
|
|
338
358
|
const agents = Object.entries(config.agents || {});
|
|
339
359
|
if (agents.length === 0) {
|
|
@@ -425,7 +445,7 @@ export async function run(runtime, version) {
|
|
|
425
445
|
);
|
|
426
446
|
return 1;
|
|
427
447
|
}
|
|
428
|
-
await agentRunner.wake(args[0], agent, state);
|
|
448
|
+
await agentRunner.wake(args[0], agent, state, config.env);
|
|
429
449
|
return 0;
|
|
430
450
|
},
|
|
431
451
|
init: async () => {
|
|
@@ -440,6 +460,12 @@ export async function run(runtime, version) {
|
|
|
440
460
|
proc.stderr.write(result.error + "\n");
|
|
441
461
|
return result.code;
|
|
442
462
|
}
|
|
463
|
+
// A fresh init defaults the posture to `brief`, the opted-into trust
|
|
464
|
+
// contract. Only write when none is recorded so re-running never flips
|
|
465
|
+
// an existing posture.
|
|
466
|
+
if ((await readPosture(fs, POSTURE_PATH)) === null) {
|
|
467
|
+
await writePosture(fs, POSTURE_PATH, "brief");
|
|
468
|
+
}
|
|
443
469
|
return 0;
|
|
444
470
|
},
|
|
445
471
|
update: () => runUpdate(args),
|
|
@@ -449,6 +475,22 @@ export async function run(runtime, version) {
|
|
|
449
475
|
},
|
|
450
476
|
validate,
|
|
451
477
|
status: showStatus,
|
|
478
|
+
posture: async () => {
|
|
479
|
+
if (!args[0]) {
|
|
480
|
+
const current = effectivePosture(await readPosture(fs, POSTURE_PATH));
|
|
481
|
+
proc.stdout.write(`posture: ${current}\n`);
|
|
482
|
+
return 0;
|
|
483
|
+
}
|
|
484
|
+
if (!POSTURES.includes(args[0])) {
|
|
485
|
+
cli.usageError(
|
|
486
|
+
`invalid posture "${args[0]}"; expected one of ${POSTURES.join(", ")}`,
|
|
487
|
+
);
|
|
488
|
+
return 2;
|
|
489
|
+
}
|
|
490
|
+
await writePosture(fs, POSTURE_PATH, args[0]);
|
|
491
|
+
logger.info(`Posture recorded: ${args[0]}`);
|
|
492
|
+
return 0;
|
|
493
|
+
},
|
|
452
494
|
};
|
|
453
495
|
|
|
454
496
|
const handler = COMMANDS[command];
|
package/src/posture.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Posture — read/write the adoption-posture record and resolve the
|
|
3
|
+
* draft-side deny set from the skill-posture manifest.
|
|
4
|
+
*
|
|
5
|
+
* The two committed posture strings are the only valid values; they appear
|
|
6
|
+
* verbatim in CLI flags, `status` output, and landing-page copy.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** The two adoption postures, in the order the spec commits them. */
|
|
10
|
+
export const POSTURES = ["brief", "brief+draft"];
|
|
11
|
+
|
|
12
|
+
/** Default for a posture-less read (interim window / fresh-read fallback). */
|
|
13
|
+
export const DEFAULT_POSTURE = "brief";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Read the recorded posture from disk.
|
|
17
|
+
* @param {import("@forwardimpact/libutil/runtime").Runtime["fs"]} fs
|
|
18
|
+
* @param {string} posturePath - Path to `posture.json`.
|
|
19
|
+
* @returns {Promise<"brief"|"brief+draft"|null>} The recorded posture, or
|
|
20
|
+
* `null` when the file is absent or its contents are not a committed string.
|
|
21
|
+
*/
|
|
22
|
+
export async function readPosture(fs, posturePath) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = JSON.parse(await fs.readFile(posturePath, "utf8"));
|
|
25
|
+
return POSTURES.includes(raw?.posture) ? raw.posture : null;
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Persist a posture to disk. The record is its own file so the wake path can
|
|
33
|
+
* open it read-only and never alter the recorded posture.
|
|
34
|
+
* @param {import("@forwardimpact/libutil/runtime").Runtime["fs"]} fs
|
|
35
|
+
* @param {string} posturePath - Path to `posture.json`.
|
|
36
|
+
* @param {string} value - Must be one of {@link POSTURES}.
|
|
37
|
+
* @returns {Promise<void>}
|
|
38
|
+
*/
|
|
39
|
+
export async function writePosture(fs, posturePath, value) {
|
|
40
|
+
if (!POSTURES.includes(value)) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`invalid posture "${value}"; expected one of ${POSTURES.join(", ")}`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
await fs.writeFile(posturePath, JSON.stringify({ posture: value }) + "\n");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the effective posture, applying the default when no posture has been
|
|
50
|
+
* recorded so a posture-less install behaves as `brief`.
|
|
51
|
+
* @param {"brief"|"brief+draft"|null} stored
|
|
52
|
+
* @returns {"brief"|"brief+draft"}
|
|
53
|
+
*/
|
|
54
|
+
export function effectivePosture(stored) {
|
|
55
|
+
return stored ?? DEFAULT_POSTURE;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Load the skill-posture membership manifest.
|
|
60
|
+
* @param {import("@forwardimpact/libutil/runtime").Runtime["fs"]} fs
|
|
61
|
+
* @param {string} manifestPath - Path to `skill-postures.json`.
|
|
62
|
+
* @returns {Promise<Record<string, "brief"|"draft">>}
|
|
63
|
+
*/
|
|
64
|
+
export async function loadManifest(fs, manifestPath) {
|
|
65
|
+
return JSON.parse(await fs.readFile(manifestPath, "utf8"));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The skills the manifest classifies as draft-side.
|
|
70
|
+
* @param {Record<string, "brief"|"draft">} manifest
|
|
71
|
+
* @returns {string[]} Skill names whose class is `"draft"`.
|
|
72
|
+
*/
|
|
73
|
+
export function draftSkills(manifest) {
|
|
74
|
+
return Object.entries(manifest)
|
|
75
|
+
.filter(([, cls]) => cls === "draft")
|
|
76
|
+
.map(([name]) => name);
|
|
77
|
+
}
|