Skip to content

Commit 65e3595

Browse files
committed
remove agent action
1 parent a242bce commit 65e3595

File tree

9 files changed

+3
-60
lines changed

9 files changed

+3
-60
lines changed

src/Backend/View/Agent.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public function getCollection(QueryFilter $filter, ContextInterface $context)
6161
'name' => Table\Generated\AgentTable::COLUMN_NAME,
6262
'description' => Table\Generated\AgentTable::COLUMN_DESCRIPTION,
6363
'outgoing' => Table\Generated\AgentTable::COLUMN_OUTGOING,
64-
'action' => Table\Generated\AgentTable::COLUMN_ACTION,
6564
'metadata' => $builder->fieldJson(Table\Generated\AgentTable::COLUMN_METADATA),
6665
'insertDate' => $builder->fieldDateTime(Table\Generated\AgentTable::COLUMN_INSERT_DATE),
6766
]),
@@ -84,7 +83,6 @@ public function getEntity(string $id, ContextInterface $context)
8483
'introduction' => Table\Generated\AgentTable::COLUMN_INTRODUCTION,
8584
'tools' => $builder->fieldJson(Table\Generated\AgentTable::COLUMN_TOOLS),
8685
'outgoing' => Table\Generated\AgentTable::COLUMN_OUTGOING,
87-
'action' => Table\Generated\AgentTable::COLUMN_ACTION,
8886
'metadata' => $builder->fieldJson(Table\Generated\AgentTable::COLUMN_METADATA),
8987
'insertDate' => $builder->fieldDateTime(Table\Generated\AgentTable::COLUMN_INSERT_DATE),
9088
]);

src/Installation/DataBag.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function addActionCommit(string $action, string $user, string $commitHash
233233
];
234234
}
235235

236-
public function addAgent(string $category, string $connection, int $type, string $name, string $description, string $introduction, array $tools, string $outgoing, string $action, int $status = Table\Agent::STATUS_ACTIVE, ?array $metadata = null, ?string $date = null, ?string $tenantId = null): void
236+
public function addAgent(string $category, string $connection, int $type, string $name, string $description, string $introduction, array $tools, string $outgoing, int $status = Table\Agent::STATUS_ACTIVE, ?array $metadata = null, ?string $date = null, ?string $tenantId = null): void
237237
{
238238
$this->data['fusio_agent'][$name] = [
239239
'tenant_id' => $tenantId,
@@ -246,7 +246,6 @@ public function addAgent(string $category, string $connection, int $type, string
246246
'introduction' => $introduction,
247247
'tools' => Parser::encode($tools),
248248
'outgoing' => $outgoing,
249-
'action' => $action,
250249
'metadata' => $metadata !== null ? json_encode($metadata) : null,
251250
'insert_date' => (new \DateTime($date ?? 'now'))->format('Y-m-d H:i:s'),
252251
];

src/Migrations/Version20230508210151.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public function up(Schema $schema) : void
6767
$agentTable->addColumn('introduction', 'text');
6868
$agentTable->addColumn('tools', 'text', ['notnull' => false, 'default' => null]);
6969
$agentTable->addColumn('outgoing', 'string', ['length' => 255, 'notnull' => false, 'default' => null]);
70-
$agentTable->addColumn('action', 'string', ['length' => 255, 'notnull' => false, 'default' => null]);
7170
$agentTable->addColumn('metadata', 'text', ['notnull' => false]);
7271
$agentTable->addColumn('insert_date', 'datetime');
7372
$agentTable->setPrimaryKey(['id']);

src/Migrations/Version20260218181413.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public function up(Schema $schema): void
4545
$agentTable->addColumn('introduction', 'text');
4646
$agentTable->addColumn('tools', 'text', ['notnull' => false, 'default' => null]);
4747
$agentTable->addColumn('outgoing', 'string', ['length' => 255, 'notnull' => false, 'default' => null]);
48-
$agentTable->addColumn('action', 'string', ['length' => 255, 'notnull' => false, 'default' => null]);
4948
$agentTable->addColumn('metadata', 'text', ['notnull' => false]);
5049
$agentTable->addColumn('insert_date', 'datetime');
5150
$agentTable->setPrimaryKey(['id']);

src/Service/Agent.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public function create(AgentCreate $agent, UserContext $context): int
6767
$row->setIntroduction($agent->getIntroduction());
6868
$row->setTools($agent->getTools() !== null ? Parser::encode($agent->getTools()) : null);
6969
$row->setOutgoing($agent->getOutgoing());
70-
$row->setAction($agent->getAction());
7170
$row->setInsertDate(LocalDateTime::now());
7271
$row->setMetadata($agent->getMetadata() !== null ? Parser::encode($agent->getMetadata()) : null);
7372
$this->agentTable->create($row);
@@ -107,7 +106,6 @@ public function update(string $agentId, AgentUpdate $agent, UserContext $context
107106
$existing->setIntroduction($agent->getIntroduction() ?? $existing->getIntroduction());
108107
$existing->setTools($agent->getTools() !== null ? Parser::encode($agent->getTools()) : $existing->getTools());
109108
$existing->setOutgoing($agent->getOutgoing() ?? $existing->getOutgoing());
110-
$existing->setAction($agent->getAction() ?? $existing->getAction());
111109
$existing->setMetadata($agent->getMetadata() !== null ? Parser::encode($agent->getMetadata()) : $existing->getMetadata());
112110
$this->agentTable->update($existing);
113111

src/Table/Generated/AgentColumn.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ enum AgentColumn : string implements \PSX\Sql\ColumnInterface
1515
case INTRODUCTION = \Fusio\Impl\Table\Generated\AgentTable::COLUMN_INTRODUCTION;
1616
case TOOLS = \Fusio\Impl\Table\Generated\AgentTable::COLUMN_TOOLS;
1717
case OUTGOING = \Fusio\Impl\Table\Generated\AgentTable::COLUMN_OUTGOING;
18-
case ACTION = \Fusio\Impl\Table\Generated\AgentTable::COLUMN_ACTION;
1918
case METADATA = \Fusio\Impl\Table\Generated\AgentTable::COLUMN_METADATA;
2019
case INSERT_DATE = \Fusio\Impl\Table\Generated\AgentTable::COLUMN_INSERT_DATE;
2120
}

src/Table/Generated/AgentRow.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class AgentRow implements \JsonSerializable, \PSX\Record\RecordableInterface
1515
private ?string $introduction = null;
1616
private ?string $tools = null;
1717
private ?string $outgoing = null;
18-
private ?string $action = null;
1918
private ?string $metadata = null;
2019
private ?\PSX\DateTime\LocalDateTime $insertDate = null;
2120
public function setId(int $id): void
@@ -106,14 +105,6 @@ public function getOutgoing(): ?string
106105
{
107106
return $this->outgoing;
108107
}
109-
public function setAction(?string $action): void
110-
{
111-
$this->action = $action;
112-
}
113-
public function getAction(): ?string
114-
{
115-
return $this->action;
116-
}
117108
public function setMetadata(?string $metadata): void
118109
{
119110
$this->metadata = $metadata;
@@ -145,7 +136,6 @@ public function toRecord(): \PSX\Record\RecordInterface
145136
$record->put('introduction', $this->introduction);
146137
$record->put('tools', $this->tools);
147138
$record->put('outgoing', $this->outgoing);
148-
$record->put('action', $this->action);
149139
$record->put('metadata', $this->metadata);
150140
$record->put('insert_date', $this->insertDate);
151141
return $record;
@@ -168,7 +158,6 @@ public static function from(array|\ArrayAccess $data): self
168158
$row->introduction = isset($data['introduction']) && is_string($data['introduction']) ? $data['introduction'] : null;
169159
$row->tools = isset($data['tools']) && is_string($data['tools']) ? $data['tools'] : null;
170160
$row->outgoing = isset($data['outgoing']) && is_string($data['outgoing']) ? $data['outgoing'] : null;
171-
$row->action = isset($data['action']) && is_string($data['action']) ? $data['action'] : null;
172161
$row->metadata = isset($data['metadata']) && is_string($data['metadata']) ? $data['metadata'] : null;
173162
$row->insertDate = isset($data['insert_date']) && $data['insert_date'] instanceof \DateTimeInterface ? \PSX\DateTime\LocalDateTime::from($data['insert_date']) : null;
174163
return $row;

src/Table/Generated/AgentTable.php

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class AgentTable extends \PSX\Sql\TableAbstract
1919
public const COLUMN_INTRODUCTION = 'introduction';
2020
public const COLUMN_TOOLS = 'tools';
2121
public const COLUMN_OUTGOING = 'outgoing';
22-
public const COLUMN_ACTION = 'action';
2322
public const COLUMN_METADATA = 'metadata';
2423
public const COLUMN_INSERT_DATE = 'insert_date';
2524
public function getName(): string
@@ -28,7 +27,7 @@ public function getName(): string
2827
}
2928
public function getColumns(): array
3029
{
31-
return [self::COLUMN_ID => 0x3020000a, self::COLUMN_CATEGORY_ID => 0x20000a, self::COLUMN_CONNECTION_ID => 0x20000a, self::COLUMN_TENANT_ID => 0x40a00040, self::COLUMN_STATUS => 0x20000a, self::COLUMN_TYPE => 0x20000a, self::COLUMN_NAME => 0xa000ff, self::COLUMN_DESCRIPTION => 0xa000ff, self::COLUMN_INTRODUCTION => 0xb00000, self::COLUMN_TOOLS => 0x40b00000, self::COLUMN_OUTGOING => 0x40a000ff, self::COLUMN_ACTION => 0x40a000ff, self::COLUMN_METADATA => 0x40b00000, self::COLUMN_INSERT_DATE => 0x800000];
30+
return [self::COLUMN_ID => 0x3020000a, self::COLUMN_CATEGORY_ID => 0x20000a, self::COLUMN_CONNECTION_ID => 0x20000a, self::COLUMN_TENANT_ID => 0x40a00040, self::COLUMN_STATUS => 0x20000a, self::COLUMN_TYPE => 0x20000a, self::COLUMN_NAME => 0xa000ff, self::COLUMN_DESCRIPTION => 0xa000ff, self::COLUMN_INTRODUCTION => 0xb00000, self::COLUMN_TOOLS => 0x40b00000, self::COLUMN_OUTGOING => 0x40a000ff, self::COLUMN_METADATA => 0x40b00000, self::COLUMN_INSERT_DATE => 0x800000];
3231
}
3332
/**
3433
* @return array<\Fusio\Impl\Table\Generated\AgentRow>
@@ -469,43 +468,6 @@ public function deleteByOutgoing(string $value): int
469468
$condition->like('outgoing', $value);
470469
return $this->doDeleteBy($condition);
471470
}
472-
/**
473-
* @return array<\Fusio\Impl\Table\Generated\AgentRow>
474-
* @throws \PSX\Sql\Exception\QueryException
475-
*/
476-
public function findByAction(string $value, ?int $startIndex = null, ?int $count = null, ?\Fusio\Impl\Table\Generated\AgentColumn $sortBy = null, ?\PSX\Sql\OrderBy $sortOrder = null): array
477-
{
478-
$condition = \PSX\Sql\Condition::withAnd();
479-
$condition->like('action', $value);
480-
return $this->doFindBy($condition, $startIndex, $count, $sortBy, $sortOrder);
481-
}
482-
/**
483-
* @throws \PSX\Sql\Exception\QueryException
484-
*/
485-
public function findOneByAction(string $value): ?\Fusio\Impl\Table\Generated\AgentRow
486-
{
487-
$condition = \PSX\Sql\Condition::withAnd();
488-
$condition->like('action', $value);
489-
return $this->doFindOneBy($condition);
490-
}
491-
/**
492-
* @throws \PSX\Sql\Exception\ManipulationException
493-
*/
494-
public function updateByAction(string $value, \Fusio\Impl\Table\Generated\AgentRow $record): int
495-
{
496-
$condition = \PSX\Sql\Condition::withAnd();
497-
$condition->like('action', $value);
498-
return $this->doUpdateBy($condition, $record->toRecord());
499-
}
500-
/**
501-
* @throws \PSX\Sql\Exception\ManipulationException
502-
*/
503-
public function deleteByAction(string $value): int
504-
{
505-
$condition = \PSX\Sql\Condition::withAnd();
506-
$condition->like('action', $value);
507-
return $this->doDeleteBy($condition);
508-
}
509471
/**
510472
* @return array<\Fusio\Impl\Table\Generated\AgentRow>
511473
* @throws \PSX\Sql\Exception\QueryException

tests/Fixture.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private static function appendTestInserts(DataBag $data): void
142142
$data->addFirewall('my_v4_rule', '192.168.2.1', ['foo' => 'bar']);
143143
$data->addFirewall('my_v6_rule', '2001:0db8:85a3:08d3:1319:8a2e:0370:7344', ['foo' => 'bar']);
144144
$data->addForm('my_form', 'test.createFoo', ['foo' => 'bar'], ['foo' => 'bar']);
145-
$data->addAgent('default', 'Agent', Table\Agent::TYPE_GENERAL, 'agent-test', 'An agent test', 'A test agent which always return "Hello World"', ['test_listFoo'], 'schema://Entry-Schema', 'action://Inspect-Action', date: '2026-02-22 13:06:00');
145+
$data->addAgent('default', 'Agent', Table\Agent::TYPE_GENERAL, 'agent-test', 'An agent test', 'A test agent which always return "Hello World"', ['test_listFoo'], 'schema://Entry-Schema', date: '2026-02-22 13:06:00');
146146
$data->addAgentMessage('agent-test', 'Administrator', Table\Agent\Message::ORIGIN_USER, 'This is a test message', date: '2026-02-22 19:17:00');
147147
$data->addAgentMessage('agent-test', 'Administrator', Table\Agent\Message::ORIGIN_ASSISTANT, 'And an agent response', 1, date: '2026-02-22 19:17:00');
148148
$data->addWebhook('foo-event', 'Administrator', 'ping', 'http://www.fusio-project.org/ping');

0 commit comments

Comments
 (0)